You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
Version 1
Current »
Reverse API Module
reverseAPI_add |
---|
URL | /api/v1/api.php?target=reverseAPI&action=add |
Description | Add a Reverse API Endpoint |
Returns | Examples: SUCCESSFUL | performs ResourceAPI-﹥Get operation to return the newly-created entry, thus will appear similar to a "Get" return: {"success":1,"message":"Reverse API endpoint added","data":{"id":"1","name":"TestPoint2","type":"local","created_by":"user","last_modified":"2015-04-01 12:24:57","call":"http:\/\/www.test.com?api.php","presentation":null}} | ERROR | {"success":0, "message":"error message"} |
|
Required Parameters | Name | Type | Example | Description |
---|
name | STRING | TestPoint2 | The name of the rAPI object | type | STRING | local | The type of the rAPI object. Valid settings are 'local' and 'external'. | call | STRING | http://www.test.com?api.php&server={serverId} | The URL or the system path which is first decoded against a resource and then hit when this rAPI endpoint is invoked. |
|
Optional Parameters | Name | Type | Example | Description |
---|
presentation | STRING | endpoint = function(data, outputDiv) {console.log(outputDiv);}; | The Javascript code used to display this endpoint on a resource page. |
|
Example URL | /api/v1/api.php?target=reverseAPI&action=add&name=TestPoint2&type=local&call=http://www.test.com?api.php&server={serverId} |
reverseAPI_get |
---|
URL | /api/v1/api.php?target=reverseAPI&action=get |
Description | Fetches one or more Reverse API endpoints |
Returns | Examples: SUCCESSFUL | An array of ReverseAPI objects: {"id":"535","name":"Observium RAM Graph","type":"external","created_by":"user","last_modified":"2015-03-18 09:16:49","call":"http:\/\/observium.tcp0.com\/graph.php?height=200&width=265&type=device_ucd_memory&legend=no&username=api&password=password&device={observium-id}","presentation":"endpoint = function(data, outputDiv) {\n\n outputDiv.css('font-family','Helvetica, Arial, sans-serif;');\n\n\toutputDiv.append(\"﹤div style='font-size:18;'﹥RAM Usage﹤\/div﹥\");\n\n\tif (data == \"\") {\n\t\toutputDiv.append(\"﹤div ﹥No data returned﹤\/div﹥\");\n\t\treturn;\n\t}\n\n\toutputDiv.append('﹤div style=\"margin-left:-18px;margin-top:-3px;\"﹥﹤img src=\"data:image\/png;base64,' + btoa(data) + '\" \/﹥﹤\/div﹥');\n};"} | ERROR | {"success":0, "message":"error message"} |
Return Detail: Name | Type | Description |
---|
id | INTEGER | The id of the rAPI objectSt | name | STRING | The name of the rAPI object | type | STRING | The type of the rAPI object | created_by | STRING | What user created the rAPI object | last_modified | DATETIME | When this rAPI object was last changed | call | STRING | The URL or the system path which is first decoded against a resource and then hit when this rAPI endpoint is invoked. | presentation | STRING | The Javascript code used to display this endpoint on a resource page. |
|
Required Parameters | None |
Optional Parameters | Name | Type | Example | Description |
---|
id | INTEGER | 535 | The id of the rAPI objectSt | name | STRING | TestPoint2 | The name of the rAPI object | type | STRING | external | The type of the rAPI object. Valid settings are 'local' and 'external'. | created_by | STRING | user | The user who created the rAPI object |
|
Example URL | /api/v1/api.php?target=reverseAPI&action=get&name=TestPoint2 |
reverseAPI_delete |
---|
URL | /api/v1/api.php?target=reverseAPI&action=delete |
Description | Delete a rAPI endpoint |
Returns | Examples: SUCCESSFUL | {"success":1,"message":"Reverse API endpoint deleted"} | ERROR | {"success":0, "message":"error message"} |
|
Required Parameters | Name | Type | Example | Description |
---|
id | INTEGER | 535 | The id of the rAPI objectSt | name | STRING | TestPoint2 | The name of the rAPI object |
|
Optional Parameters | None |
Example URL | /api/v1/api.php?target=reverseAPI&action=delete&id=535&name=TestPoint2 |
reverseAPI_update |
---|
URL | /api/v1/api.php?target=reverseAPI&action=update |
Description | Update an existing rAPI endpoint |
Returns | Examples: SUCCESSFUL | ResourceAPI-﹥Get updated object, thus will appear the same as a "Get" return: {"id":"535","name":"Observium RAM Graph","type":"external","created_by":"user","last_modified":"2015-03-18 09:16:49","call":"http:\/\/observium.tcp0.com\/graph.php?height=200&width=265&type=device_ucd_memory&legend=no&username=api&password=password&device={observium-id}","presentation":"endpoint = function(data, outputDiv) {\n\n outputDiv.css('font-family','Helvetica, Arial, sans-serif;');\n\n\toutputDiv.append(\"﹤div style='font-size:18;'﹥RAM Usage﹤\/div﹥\");\n\n\tif (data == \"\") {\n\t\toutputDiv.append(\"﹤div ﹥No data returned﹤\/div﹥\");\n\t\treturn;\n\t}\n\n\toutputDiv.append('﹤div style=\"margin-left:-18px;margin-top:-3px;\"﹥﹤img src=\"data:image\/png;base64,' + btoa(data) + '\" \/﹥﹤\/div﹥');\n};"} | ERROR | {"success":0, "message":"error message"} |
|
Required Parameters | Name | Type | Example | Description |
---|
id | INTEGER | 535 | The id of the rAPI objectSt |
|
Optional Parameters | Name | Type | Example | Description |
---|
name | STRING | TestPoint2 | The name of the rAPI object | type | STRING | external | The type of the rAPI object. Valid settings are 'local' and 'external'. | call | STRING | http://www.test.com?api.php&server={serverId}&action=12 | The URL or the system path which is first decoded against a resource and then hit when this rAPI endpoint is invoked. | presentation | STRING | endpoint = function(data, outputDiv) {console.log(outputDiv);}; | The Javascript code used to display this endpoint on a resource page. |
|
Example URL | /api/v1/api.php?target=reverseAPI&action=update&id=535&name=TestPoint2 |
reverseAPI_execute |
---|
URL | /api/v1/api.php?target=reverseAPI&action=execute |
Description | Decodes a rAPI call against a Resource, executes the resulting string, returns the result along with the presentation code |
Returns | Examples: SUCCESSFUL | The result of a rAPI call customized for the supplied resource {“data”:”\u0017\u00fbD","presentation":"endpoint = function(data, outputDiv) {\n\n\toutputDiv.css('font-family','Helvetica, Arial, sans-serif;');\n\n\toutputDiv.append(\"﹤div style='font-size:18;'﹥Port Traffic﹤\/div﹥\");\n\n\tif (data == \"\") {\n\t\toutputDiv.append(\"﹤div﹥No data returned﹤\/div﹥\");\n\t\treturn;\n\t}\n\n\toutputDiv.append('﹤div style=\"margin-left:-15px;margin-top:-3px;\"﹥﹤img src=\"data:image\/png;base64,' + btoa(data) + '\" \/﹥﹤\/div﹥');\n};"}} | ERROR | {"success":0, "message":"error message"} |
Return Detail: Name | Type | Description |
---|
data | MIXED | The result of the reverse API call. Could be binary data, could be JSON. | presentation | STRING | The presentation javascript which pairs with this rAPI call |
|
Required Parameters | Name | Type | Example | Description |
---|
id | INTEGER | 537 | The id of the rAPI objectSt | resource_id | INTEGER | 2245 | ID of the resource |
|
Optional Parameters | None |
Example URL | /api/v1/api.php?target=reverseAPI&action=execute&id=537&resource_id=2245 |