Methods 1.1
From Aviberry API
| Language: |
English • Русский |
Contents
Still have a question?
API Methods
- startConversion
- cancelConversion
- deleteConversion
- getConversion
- getConversionCount
- getConversions
- getProgress
- getTraffic
All API methods have camelCase names and should be pointed out as such when making a call: in URL request for GET method and in the request body for POST method. In API calls using GET methods all the parameter values should be coded according to standard.
The types of method parameters are: string, array or object. Arrays or objects allow additional nesting levels, i.e. they can have arrays or subobjects as properties. "Object" is understood to be the associative array, i.e. collection of matches key=value. Depending on the request protocol, such "object" can be JSON-object for JSON-RPC or XML-structure for XML-RPC.
All API methods, receiving heterogeneous input data, always output homogeneous data. For example, if some method receives string identifier or string identifier array, it always returns array with one or more elements, representing required data on corresponding identifiers. This principle is designed to simplify the client code writing.
For GET method requests, the "object" should be transferred according to convention that each object property with defined value should be coded (according to special notation) in the URL, and each element appears as a separate parameter:
object[property]=value object[property][subproperty]=value object[property][subproperty][subsubproperty]=value etc.,
where [ and ] characters are mandatory syntax items. Below object properties will be indicated according to this syntax.
"Array" is understood as standard array, where elements are numbered in sequence from 0. Depending on the request protocol, such "array" can be JSON-array for JSON-RPC or XML-array for XML-RPC.
For GET method requests, the "array" should be transferred according to convention that each array element with defined value should be coded (according to special notation, listed below) in the URL, and each element appears as a separate parameter:
object[]=value // object[0] object[]=value // object[1] object[]=value // object[2] etc.,
where [ and ] characters are mandatory syntax items.
For GET method calls, Boolean value true can be coded as '1', 'true' or 'yes'. Other values are considered false.
Proposed implementation of object transfer with GET method "violates" the official specification for JSON-RPC 1.1 protocol. According to JSON-RPC 1.1 specification the objects are not transferred via GET method at all, but non-associative one-dimensional array can be. For XML-RPC GET requests are not foreseen by standard at all, but they will be accepted and processed if designed as described above. For JSON-RPC in fact, there is no "violation" of standard, but single specifically defined parameters are transferred.
Developers can use external libraries for Aviberry API calls so to avoid creating request body manually as well as processing server response for converting the response in the suitable data input format for used development tool. Below there is a list of popular libraries for various programming languages:
Using these or other libraries, one should send all requests via POST method, since none of the external libraries recognizes the described above convention for transferring objects-parameters via GET method. This feature of calling the API functionality via GET method is designed for the overall perfection of the solution and can be useful in some cases, since sending the GET request is the easiest and quickest way to call Aviberry API method, avoiding external means.
Contents
Still have a question?
| Language: |
English • Русский |
