Add Generic Action¶
Action |
add |
---|---|
title |
Get the GUI Add form. |
method |
GET |
URL |
/api/<resource_type>/<resource_name>/add/ |
Parameters |
hierarchy=[hierarchy], format=json |
Response |
The schema of <resource_type>/<resource_name> as JSON |
support_async |
false |
class |
add |
When adding the &schema=1
parameter, the response contains the schema of the payload for the Create action.
The schema required to add the resource may be different from the schema that is used to obtain the details of the resource. Refer to the schema of the GUI Add form.
The actions in the response shows the URL for the POST API call to create an instance (see Create action).
For example, the request below shows the required details. (Using variables [hierarchy])
Request:
GET /api/data/AccessProfile/add/
?hierarchy=[hierarchy]
&format=json
&schema=1
Response snippet - POST call:
"create": {
"class": "add",
"href": "/api/data/HierarchyNode/?hierarchy=[hierarchy]",
"method": "POST",
"support_async": true,
"title": "Create"
}
Response snippet - schema:
"schema": {
"$schema": "http://json-schema.org/draft-03/schema",
"properties": {
"description": {
"description": "A general description for the hierarchy node.",
"title": "Description",
"type": "string"
},
"name": {
"description": "The name by which this hierarchy node will
be known.",
"pattern": "^[A-Za-z0-9_\\- ]+$",
"required": true,
"title": "Name",
"type": "string"
},
"node_type": {
"choices": [],
"description": "A type label for this node which refers
to a Hierarchy Node Type.",
"format": "uri",
"is_password": false,
"items": {
"is_password": false
},
"readonly": false,
"required": false,
"target": "/api/data/HierarchyNodeType/choices/?hierarchy=[hierarchy]",
"target_attr": "name",
"target_model_type": "data/HierarchyNodeType",
"title": "Hierarchy node type",
"type": "string"
}
},
"schema_version": "0.1",
"type": "object"
},