Response Content
The results of your requests.
What is response content?
Our API responses have what's called a body that holds the main content of the response. This content is generally the detailed results of your requests. The format of the content depends on the request you made.
Text content
Often, our response content will be text. For example, let's say you submitted this successful request for information about a product:
GET https://restapi.rev.io/v1/products/1001
Here's our response:
HTTP/1.1 200 OK
Content-Length: 590
Content-Type: application/json
Server: Microsoft-IIS/8.5
X-Powered-By: ASP.NET
Date: Thu, 22 Feb 2018 21:02:02 GMT
X-Frame-Options: SAMEORIGIN
{
"ok": true,
"product_id": 1001,
"product_type_id": 320,
"description": "a4045053-30a5-45d0-aa16-64e57577e321",
"code_1": "",
"code_2": "",
"rate": 0,
"cost": 0,
"buy_rate": 0,
"created_date": "2016-10-21T16:24:21.293",
"created_by": null,
"active": true,
"creates_order": false,
"provider_id": 0,
"bills_in_arrears": false,
"prorates": true,
"customer_class": null,
"long_description": "longdescription",
"ledger_code": null,
"free_months": null,
"automatic_expiration_months": null,
"order_completion_billing": false,
"tax_class_id": null
}
The message body is visible at the bottom of the response, starting with the opening curly bracket ({). Its content has the information you requested in text (in JSON format).
Other content
Sometimes our responses will contain things besides text. For example, let's say you made this successful request to get a PDF of a quote:
GET https://restapi.rev.io/v1/requests/33/pdf?request_template_id=2
The body of our response would contain the actual PDF.
Responses to failed requests
If you make a request that fails, sometimes our response will contain more details about the failure.
For example, let's say you made another request to create a note, but this time didn't specify the customer ID:
curl --request POST \
--url https://restapi.rev.io/v1/Notes \
--data '{"body":"This is a test note."}'
Here's the body of our response:
[
{
"ok": false,
"error": "BadRequest",
"field": null,
"message": "customer_id, order_id, request_id, or task_id must be specified."
}
]
This error tells you a note needs to be linked to either a customer, order, request, or task, so you need to specify one of those IDs when creating a note.
Updated almost 7 years ago