Skip to main content

Action specifications for links

What actions need to be specified?

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

How should I implement these actions?

Creating action specifications for a link is exactly the same process you follow when you create your service's 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 exactly 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": { // defines the input requirements for the action.
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"results": { // defines the expected output of the action.
"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", // the associated service specification
"link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393" // the associated link specification
}'

Delete

np link-specification action-specification create \
--linkSpecificationId $link_spec_id \
--body '{
"name": "Create my link delete action spec",
"type": "delete",
"parameters": { // defines the input requirements for the action.
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"results": { // defines the expected output of the action.
"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", // the associated service specification
"link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393" // the associated link specification
}'

Update

np link-specification action-specification create \
--linkSpecificationId $link_spec_id \
--body '{
"name": "Create my link update action spec",
"type": "update",
"parameters": { // defines the input requirements for the action.
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"results": { // defines the expected output of the action.
"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", // the associated service specification
"link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393" // the associated link specification
}'

Custom

np link-specification action-specification create \
--linkSpecificationId $link_spec_id \
--body '{
"name": "Create my link custom action spec",
"type": "custom",
"parameters": { // defines the input requirements for the action.
"schema": {
"type": "object",
"properties": {
"my_string_property": {
"type": "string"
},
"my_number_property": {
"type": "number",
"default": 0
}
},
"required": [
"my_string_property"
]
},
"values": {}
},
"results": { // defines the expected output of the action.
"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", // the associated service specification
"link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393" // the associated link specification
}'