Resources
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 | General Parameters:
Limit Results by ID: At most, one of the following:
At most, one of the following:
At most, one of the following:
Limit Results by Resource Link: For resources for which exist a Resource Link, you may limit by resource link data:
Limit Results by Attributes: You can further limit the results based on attributes the resources may have:
Result Ordering:
Range Selection / Paging: You can restrict the range of the resources returned.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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) |
| |||||||||
Required Parameters (meta[type] = gadgets) |
Example - Adding the IPAM Gadget to a Section: api.php?target=resource&action=add&meta[type]=section&meta[name]=TestSection_1&meta[parent_id]=1&gadgets[0][uuid]=uuid-586dbd260d6ef&gadgets[0][code]=_ipam |
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 |
| ||||||
Optional Parameters |
A recursive delete will delete all resources, which are permitted to be deleted, from the bottom up. Imagine the following hierarchy: A B1 B2 C11 C12 C21 C22 If a recursive delete is performed on A, but C21 is not deletable, the following resources would still be deleted: (B1, C11, C12, C22). B2 would not be deleted because it depends on C21 and A would not be deleted because it depends on B2. | ||||||
Example URL | /api/v1/api.php?target=resource&action=delete&id=57 |
get resource link | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description | Get available resource links. If no resource links exist for the given resource, an empty object is returned. | ||||||||||||||||||||||||||||||||||||||||
URL | /api/v1/api.php?target=resource&action=getLink | ||||||||||||||||||||||||||||||||||||||||
Returns | Examples:
Return Detail:
Meta Attributes:
Optional Attributes:
|
get resource search | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description | Search the resource system for the provided term. Performs a "LIKE" search to return similar results. | ||||||||||||||||||||||||||||||||||||||||
URL | /api/v1/api.php?target=resource&action=get&search= | ||||||||||||||||||||||||||||||||||||||||
Returns | Examples:
Return Detail:
Required Attributes:
| ||||||||||||||||||||||||||||||||||||||||
Example URL | /api/v1/api.php?target=resource&action=get&search=6connect |