get | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
URL | /api/v1/api.php?target=resource&action=get | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description | Get a resource or resources | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns | Examples: SUCCESSFUL: {"success":1,"message":"Search successful","data":[{"id":"57","name":"2nd Email","slug":"6c-contact-email2","type":"field","parent_id":"1","category_id":null,"attr":[]}]} ERROR: {"success":0,"message":"Search failed"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Optional Parameters |
At most, one of the following:
At most, one of the following:
At most, one of the following:
You can set the order of the results by setting the STRING value of the parameter orderby to one of the following :
You can set the direction of the ordering of the results by setting the STRING value of the parameter order to one of the following :
You can further limit the results based on attributes the resources may have:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example URL | /api/v1/api.php?target=resource&action=get&id=7 |
add | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
URL | /api/v1/api.php?target=resource&action=add | |||||||||
Description | Add a resource. | |||||||||
Returns | Examples: /api/v1/api.php?target=resource&action=add&meta[name]=apitest&meta[type]=entry&meta[section]=firewall&fields[network-fqdn][]=www.example.com SUCCESSFUL: {"success":1,"message":"Resource added","data":{"id":1077,"name":"apitest","slug":"apitest","type":"entry","parent_id":1,"category_id":"NULL","attr":{"_section":"70","network-fqdn":"www.example.com"},"section":{"id":"70","name":"Firewall","slug":"firewall","type":"section","parent_id":"1","category_id":null,"attr":{}}}} /api/v1/api.php?target=resource&action=add&meta[name]=apitest&meta[type]=entry&fields[network-fqdn][]=www.example.com ERROR:{"success":0,"message":"Entries must be assigned to a section"} | |||||||||
Required Parameters |
| |||||||||
Optional Parameters |
| |||||||||
Required Parameters (meta[type] = entry) | One of the following:
| |||||||||
Optional Parameters (meta[type] = entry) |
| |||||||||
Required Parameters (meta[type] = field) |
| |||||||||
Optional Parameters (meta[type] = field) |
|
update | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
URL | /api/v1/api.php?target=resource&action=update | |||||||||
Description | Update a resource. | |||||||||
Returns | Examples: ERROR: {"success":0,"message":"No resource found with ID: 1079"} | |||||||||
Required Parameters |
| |||||||||
Optional Parameters (meta[type] = entry) |
| |||||||||
Optional Parameters (meta[type] = section) |
|
delete | |||||||
---|---|---|---|---|---|---|---|
URL | /api/v1/api.php?target=resource&action=delete | ||||||
Description | Delete a resource. | ||||||
Returns | Examples: SUCCESSFUL: {"success":1,"message":"Resource deleted."} ERROR: {"success":0,"message":"No resource found with ID: 57"} | ||||||
Required Parameters |
| ||||||
Example URL | /api/v1/api.php?target=resource&action=delete&id=57 |