Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DOC and version 7.2.1
HTML
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

Reverse API

Table of Contents

Overview

...

Reverse API (rAPI) calls are made to hit a user-defined URL or command line program.  If the rAPI type is set to 'external,' the system makes a HTTP request.  If the rAPI type is set to 'local', it executes the call on the command  line of the local machine. In both cases the call is first customized with the attributes of the resource supplied to the execute function.  This allows a single rAPI endpoint to serve a wide array of individual resources, fetching only information relevant to that particular resource without having to store anything locally.

 


rAPI calls are formatted thusly:

...

The interesting part about this URL is the bit in curly-braces:  {observium-id}.  When this call is made, the system decodes the URL by searching for everything within curly-braces and replaces it with data pulled from a resource. A rAPI call may have as many or as a few curly-brace replacement targets as is needed.  Each curly-brace target will be replaced with exactly one resource attribute.  All targets must be successfully replace for the command to succeed.  


For example, when this rAPI call is decoded with information from the 1-dev resource, the decoded call is as follows:

Code Block
languagetext
http://observium.tcp0.com/graph.php?height=200&width=265&type=device_bits&legend=no&username=api&password=password&device=21

...


The rAPI service then pulls the data from that URL, pairs it with its presentation code, and returns it via the execute endpoint. If a user attempted to execute the above call on a resource which did not have the “observium-id” property, the execute endpoint would return the following error:  "Reverse API Call references token 'observium-id', which does not exist in resource." 

 


Note
All curly-brace calls reference a resource attribute by their unique resource slugs.  The list of available resource attributes can be customized using the existing resource system endpoints.
Note
Curly-brace targets may take the form {parent.observium-id}.  The “parent.” prefix indicates that in decoding this particular brace, the attributes of the resource's parent are to be used.  


Reverse API Detail:

For detail on the Reverse API calls and parameters, proceed to Reverse API - Detail.