-
Notifications
You must be signed in to change notification settings - Fork 1
Endpoint Configuration Reference
The endpoint, at minimum, must specify a url and a request method.
{
"url": "http://example.com/api/endpoint",
"method": "GET"
}
Get requests can include query parameters seperately from the URL. This makes it easier to read and edit. The parameters will be encoded and appended into the url before the request.
{
"url": "http://example.com/api/endpoint",
"method": "GET",
"data": {
"pageSize": 20,
"page": 1
}
}
You can post a JSON payload using the data node. It will be serialized and sent with the request.
{
"url": "http://example.com/api/endpoint",
"method": "POST",
"data": {
"attributes": {
"name": "my_name"
}
}
}
You can specify custom headers that are set on the request.
{
"url": "http://example.com/api/endpoint",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"data": {
"attributes": {
"name": "my_name"
}
}
}
You can execute a script once the request completes. This script is given access to all the details for the request and response. Multiple scripts can be given and each will be executed. For more information on scripting check the Scripting Reference.
{
"url": "http://example.com/api/endpoint",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"onComplete": ["processResponse"],
"data": {
"attributes": {
"name": "my_name"
}
}
}
Scripts can be used to modify the request before it is sent to the server. This is useful for more complicated requests, like ones requiring authentication tokens, or dynamic data like a current time. Multiple scripts can be given and each will be executed. For more information on scripting check the Scripting Reference.
{
"url": "http://example.com/api/endpoint",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"transform": ["addData", "addAuth"],
"data": {
"attributes": {
"name": "my_name"
}
}
}
Variables defined in the global or local config can be used in the endpoint definition. They can be included in the url, request method, query params, or post data.
{
"url": "http://$host/api/endpoint",
"method": "POST",
"data": {
"attributes": {
"name": "$name"
}
}
}
Randomized fake data can be included in the url, query params, or post data using a #{key}
value. This will be expanded to a specific type of string data based on the key passed.
{
"url": "http://$host/api/endpoint",
"method": "POST",
"data": {
"attributes": {
"name": "#{fullName}",
"phone": "#{phone}",
"email": "#{email}",
}
}
}
Currently supported data keys are:
- city
- color
- country
- femaleFirstName
- femaleFullName
- maleFirstName
- maleFullName
- firstName
- lastName
- fullName
- gender
- hexColor
- ip
- industry
- jobtitle
- month
- monthNum
- monthShort
- phone
- product
- productName
- street
- streetAddress
- weekDay
- zip