Content Types
- The user does not need to set the response content type to send JSON as a response.
- If the response content type is not set that means it is application/JSON.
If ContentType is set to below system will return data accordingly.
JSON = 'application/json'
XML = 'text/xml'
YAML = 'text/yaml'
TEXT = 'text/plain'
HTML = 'text/html'
Note: If content type is set and not from above list, then API Maker will consider it as base64 encoded.
HTML
Content type HTML | |
---|---|
Response
JSON
Content type JSON | |
---|---|
Response
{
"success": false,
"statusCode": 555,
"data": "World",
"errors": [
{
"code": 401,
"message": "This is error"
}
],
"warnings": []
}
OCTET_STREAM
Content type OCTET_STREAM | |
---|---|
- It will download the image.
TEXT
Content type TEXT | |
---|---|
Response
XML
Content type XML | |
---|---|
Response
<?xml version='1.0'?>
<root>
<success>true</success>
<statusCode>200</statusCode>
<data>Hello world from the API Maker.</data>
</root>
YAML
Content type YAML | |
---|---|
Response