Overview
- application/json
- text/xml
- multipart/mixed
Authorization Header
You must use the Authorization header to send the server authentication credentials.
The Authorization header is constructed as follows:
1. Username and password are combined into a string "username:password"
2. The resulting string literal is then encoded using the RFC2045-MIME variant of Base64, except not limited to 76 char/line
3. The authorization method and a space i.e. "Basic " is then put before the encoded string.
For example, if the user agent uses 'Aladdin' as the username and 'open sesame' as the password then the header is formed as follows:
Content Type
You must supply a Content-Type header on PUT and POST operations. This can be application/json or text/xml.
Example:
- Content-Type: application/json
Accept
You must set an Accept header on all requests. This can be application/json, text/xml, multipart/mixed, text/csv or text/tsv (text/csv and text/tsv can only be used in Get Result endpoint of Reporting Jobs). You may get a text/plain response in case of error, e.g. in case of a bad request, you should treat this as an error you need to take action on.
Example:
- Accept: application/json
Reporting Jobs
For the Get Result endpoint you must set the Accept header to the same Media Type defined in the Reporting Job. If the reporting job doesn't have a Media Type defined, then it will default to application/json and Accept should be provided with application/json.
Compression
You can specify a Compression algorithm to improve the data transfer. This must be set in the Content-Encoding header. Supported Compression Algorithms are:
- gzip
- deflate
Sample Compression
var request = new HttpRequestMessage(HttpMethod.Get, baseAddress + "clients/11223344/jobs/reporting/123456789/result");
request.Headers.Authorization = GetAuthentication();
request.Headers.Add("Accept", new List {"text/csv"});
request.Headers.Add("Content-Encoding", new List {"gzip"});
var result = client.SendAsync(request).Result;
var streamProvider = result.Content.ReadAsByteArrayAsync();
var decompress = Decompress(streamProvider);
var response = Encoding.ASCII.GetString(decompress);
Batching is a web API feature that allows a customer to pack several API requests and send them to the web API service in one HTTP request and receive a single HTTP response with the response to all their requests.
Request
The maximum number of requests for a single call is 1000, and the maximum request length is 10 MB.
Supported ContentTypes are:
- Multipart/mixed
- Application/json
Sample multipart/mixed
var batchRequest = new HttpRequestMessage(HttpMethod.Post, baseAddress + "/batch")
{
Content = new MultipartContent("mixed")
{
new HttpMessageContent(new HttpRequestMessage(HttpMethod.Post,
baseAddress + "clients/11223344/jobs/reporting/KeyMetrics"))
}
};
batchRequest.Headers.Authorization = GetAuthentication();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("multipart/mixed"));
Sample application/json
Request Description
Parameter | Type |
---|---|
Id | Int32 |
To | String |
Body | String (json) |
Method | String |
Response
The response is a list of individual responses. Each response will be of BatchResponse type and it will have the request Id, code status, headers, body. If a request returns an error, this will be displayed in the BatchResponse.body. The status code for this response will also be displayed in the BatchResponse.code.
Supported Accept headers are:
- Multipart/mixed
- Application/json
Multipart/mixed
--2bb99265-6ef5-4372-be45-68dd92ca8e4a
Content-Type: application/http; msgtype=response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"data": {
"message": "OK"
},
"url": "http://.../v3/health"
}
--2bb99265-6ef5-4372-be45-68dd92ca8e4a
Content-Type: application/http; msgtype=response
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
{
"error": {
"code": 400,
"error": "BadRequest",
"message": "We have found errors trying to process your request.",
"details": []
},
"url": "http://.../v3/clients/11223344/jobs/reporting/KeyMetrics"
}
--5394c015-cfaf-4b61-9ccd-22bf97faa47e--
Application/json
Response Description
Parameter | Type |
---|---|
Id | Int32 |
Headers | {{batch.sampleDictionary}} |
Body | Object |
Code | Int16 |
Message | String |
{{apiDoc.itemName}}
Parameter | Type | Source |
---|---|---|
{{parameter.name}} | {{parameter.type}} | {{parameter.source}} |
Parameter | Type |
---|---|
{{inputDetail.type}} |