@apica-io/url-xi
Version:
URL Check for integrations and API monitoring
112 lines (110 loc) • 2.84 kB
JSON
{
"$schema": "https://files-apicasystem-com.s3-eu-west-1.amazonaws.com/schemas/url-xi-schema-v1-0.json",
"baseURL": "https://jsonplaceholder.typicode.com",
"description": "Get user resources from FAKE REST API JSON Placeholder",
"name": "Get User Resources",
"variables": [
{"key": "maxLaps","type": "number","usage": "input","value":100,"description": "Max laps for iterator"}
],
"includes": [
{
"name": "Common Variables",
"scope": "project",
"type": "vars",
"src": "common_vars.json"
},
{
"name": "posts",
"scope": "project",
"type": "data",
"src": "posts.csv",
"options": {}
}
],
"steps": [
{
"name": "Get My User",
"description": "Get my specific user from the user repository",
"requests": [
{
"config": {
"url": "/users"
},
"scripts": [
{
"name": "Get User Id",
"options": {
"builtin": [
"os"
]
},
"scope": "after",
"script": "getUserId.js"
}
]
}
]
},
{
"name": "Update posts",
"iterator": {
"value": "{{$data.posts}}",
"maxLaps": "{{maxLaps}}"
},
"requests": [
{
"name": "Get_Posts_{{$lapIdx1}}",
"condition": {
"value": "{{$data.posts.id}}",
"expression": "value.length > 0"
} ,
"config": {
"url": "/posts/{{$data.posts.id}}",
"method": "get"
},
"expectedStatus": [200,404],
"extractors": [
{
"type": "jsonpath",
"expression": "$.id",
"variable": "id"
}
]
},
{
"name": "Put_Posts_{{$lapIdx1}}",
"condition": {
"value": "{{$status}}",
"expression": "Number(value) === 200"
},
"config": {
"url": "/posts/{{id}}",
"method": "put",
"data": {
"userId": "{{userId}}",
"title": "{{$data.posts.title}}",
"body": "{{$data.posts.body}}"
}
}
},
{
"name": "Post_Posts_{{$lapIdx1}}",
"condition": {
"value": "{{$status}}",
"expression": "Number(value) === 404"
},
"config": {
"url": "/posts",
"method": "post",
"data": {
"id": "{{$data.posts.id}}",
"userId": "{{userId}}",
"title": "{{$data.posts.title}}",
"body": "{{$data.posts.body}}"
}
}
}
]
}
]
}