meta {
name: Multi-format API
type: http
}
get {
url: https://api.example.com/data
}
headers {
content-type: application/json
}
body:json {
{
"message": "API supports multiple formats"
}
}
example {
name: JSON API Example
description: An example using JSON format
request: {
url: https://api.example.com/json
method: post
mode: json
body:json: {
{
"format": "json",
"data": {
"name": "JSON Example",
"value": 123
}
}
}
}
response: {
status: {
code: 201
}
body: {
type: json
content: '''
{
"id": 1,
"format": "json",
"created": true
}
'''
}
}
}
example {
name: XML API Example
description: An example using XML format
request: {
url: https://api.example.com/xml
method: post
mode: xml
body:xml: {
xml
XML Example
456
}
}
response: {
status: {
code: 201
}
body: {
type: xml
content: '''
2
xml
true
'''
}
}
}
example {
name: Text API Example
description: An example using text format
request: {
url: https://api.example.com/text
method: post
mode: text
body:text: {
Plain text data
Format: text
Name: Text Example
Value: 789
}
}
response: {
status: {
code: 201
}
body: {
type: text
content: '''
Success: true
Format: text
ID: 3
'''
}
}
}