Summary:
Export user-defined Data Access templates.
URL:
http(s)://{server hostname}/api/dataAccess/{templateName}
Methods summary
- GET Method - exports user-defined Data Access templates.
GET Method detail
Exports user-defined Data Access templates. Also, can accept parameters that will be defined as templateParameters that can be used in expressions in the DataAccessTemplate.
An export, generated according to the user-defined Data Access template.
Request:
Name | Description |
---|---|
templateServer |
ID of the server (see GET Method detail section of Servers page) from which to retrieve the template. |
view |
name of View of which objects will be processed. This argument may appear multiple times in which case any objects belonging to at least one of the Views will be processed. |
startTime endTime |
start and end timestamp for exporting a stream data. Negative values are not allowed and the default value for these parameters is 0. As a special case, if both startTime and endTime are 0, then all the streams being exported will contain only the last sample. |
maxResults |
maximum number of elements that will be exported. |
position |
next element that the export should start from. It is optional, in which case it defaults to 0:0. The result of each export will have the “position” element defined. This element consists of pairs of numbers that are separated from other pairs by commas, and the elements of a pair are separated by a colon, e.g: 1:2,3:4,5:6 After successful call that returns maximum number of elements (defined by maxResults parameter), the position will point to the next element to continue from. To achieve continuation, the position returned from the last call should be passed along as an argument to the next call – as long as the returned value is an “END” string, which signals that no more data are available. |
Response:
An export, generated according to the user-defined Data Access template. If unsuccessful, description of the error will be returned.
Examples:
Below are three examples showing the “continuation” mechanism, together with some explanation. Please note that normally the XML output generated by Data Access mechanism is not formatted – it has only been presented as formatted here for the purpose of readability.
The first example omits the position argument, which exports data from the very beginning:
INPUT
curl -u admin:admin https://localhost/api/dataAccess/C?maxResults=5&view=All%20Objects&media=xml -H "content-type:application/xml"
OUTPUT
<C serverName="ENTLONDEV08" serverId="dae26869-46e3-46df-91a0-28ce61b28d05" templateServerId="dae26869-46e3-46df-91a0-28ce61b28d05" startTime="0" endTime="0" elementsProcessed="5" position="565:2,575:0" processingTime="0.001">
<device id="565" name="apiDevice">
<port id="572" descr=" [ Vl1 ] Vlan1" />
<port id="573" descr=" [ Fa0/1 ] FastEthernet0/1" />
<port id="574" descr=" [ Fa0/2 ] FastEthernet0/2" />
<port id="575" descr=" [ Fa0/3 ] FastEthernet0/3" />
</device>
</C>
The second one is an example of the call just after the first one, which picks up from where the previous call left off:
INPUT
curl -u admin:admin https://localhost/api/dataAccess/C?position=565:2,575:0&maxResults=5&view=All%20Objects&media=xml -H "content-type:application/xml"
OUTPUT
<C serverName="ENTLONDEV08" serverId="dae26869-46e3-46df-91a0-28ce61b28d05" templateServerId="dae26869-46e3-46df-91a0-28ce61b28d05" startTime="0" endTime="0" elementsProcessed="5" position="565:2,578:0" processingTime="0">
<device id="565" name="apiDevice">
<port id="576" descr=" [ Fa0/4 ] FastEthernet0/4" />
<port id="577" descr=" [ Fa0/5 ] FastEthernet0/5" />
<port id="578" descr=" [ Fa0/6 ] FastEthernet0/6" />
</device>
</C>
The third example is the last call, where the number of available elements were less than maxResults parameters (the elementsProcessed is less than 5, and the returned position is “END”):
INPUT
curl -u admin:admin https://localhost/api/dataAccess/C?position=646:2,805:0&maxResults=5&view=All%20Objects&media=xml -H "content-type:application/xml"
OUTPUT
<C serverName="ENTLONDEV08" serverId="dae26869-46e3-46df-91a0-28ce61b28d05" templateServerId="dae26869-46e3-46df-91a0-28ce61b28d05" startTime="0" endTime="0" elementsProcessed="4" position="END" processingTime="0">
<device id="646" name="e2821">
<port id="806" descr=" [ Gi0/1 ] GigabitEthernet0/1-mpls layer" />
<port id="807" descr=" [ Se0/1/0 ] Serial0/1/0-mpls layer" />
</device>
</C>
Comments
0 comments
Please sign in to leave a comment.