Skip to main content

Action specifications for links

What actions need to be specified?

Links support the exact same set of actions as services: create, update, delete, and custom actions.

How should I implement these actions?

Creating action specifications for a link follows the same process as creating your service actions.

The only consideration is that instead of using URLs like:

/service_specification/:id/action_specification

you will use URLs like:

/link_specification/:id/action_specification

For more info on how service actions work, refer to the action specifications docs.

Action specifications for links work the same way as they do for services. Here are examples for create, update, delete, and custom link actions.

Create

np link-specification action-specification create \
--linkSpecificationId $link_spec_id \
--body '{
"name": "Create my link action spec",
"type": "create",
"parameters": {
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
"link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
}'

Delete

np link-specification action-specification create \
--linkSpecificationId $link_spec_id \
--body '{
"name": "Create my link delete action spec",
"type": "delete",
"parameters": {
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
"link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
}'

Update

np link-specification action-specification create \
--linkSpecificationId $link_spec_id \
--body '{
"name": "Create my link update action spec",
"type": "update",
"parameters": {
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
"link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
}'

Custom

np link-specification action-specification create \
--linkSpecificationId $link_spec_id \
--body '{
"name": "Create my link custom action spec",
"type": "custom",
"parameters": {
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"results": {
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
"link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
}'