Response

The response from an API call will always be JSON. The JSON response will have four primary fields: `status`, `messages`, `meta`, and `data`.

The `status` value will either be `success` or `error`.

The `messages` value will be an array of messages. Typically the `messages` value will be an empty array. It will generally be used for error responses (like validation errors) but it could also be used to send additional information during a successful response.

The `meta` value will contain additional details about the response. For example, it could include pagination information or other relevant information.

The `data` value is where the actual data for the response is found (if the endpoint returns data). Depending on the endpoint, the `data` could be an array of values or it could be a single value.

Success

Below is an example of a successful response:

curl https://www.piperiv.com/api/v1/hello
{
  "status": "success",
  "messages": [],
  "meta": {},
  "data": {
    "name": "World"
  }
}

Error

curl https://www.piperiv.com/api/v1/hello -u "bad:key"

Below is an example of an error response:

{
  "status": "error",
  "messages": [
    "The API user or key does not appear to be valid."
  ],
  "meta": {},
  "data": {}
}