{
  "mockstudioVersion": 1,
  "id": "e293aa84-ed37-533d-a9ac-6a26fc0365a9",
  "name": "Todo API (sample)",
  "description": "A small to-do list API for learning. From learn.dhivalabs.com.",
  "port": 4010,
  "corsEnabled": true,
  "proxyBaseUrl": "",
  "recordProxy": false,
  "globalDelayMs": 0,
  "globalHeaders": {},
  "endpoints": [
    {
      "id": "da62e3c4-23ab-5c3d-902a-103ed7855ece",
      "name": "Health check",
      "method": "get",
      "path": "/health",
      "enabled": true,
      "strategy": "single",
      "responses": [
        {
          "id": "318fd8e9-31a9-5047-8416-2a5d8dcd4306",
          "label": "Healthy",
          "statusCode": 200,
          "bodyType": "json",
          "body": "{\n  \"status\": \"ok\",\n  \"time\": \"{{now}}\"\n}",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": false,
      "authHeader": "Authorization",
      "description": "Answers 200 when the API is up."
    },
    {
      "id": "b072a538-ac1a-5f7e-8100-7af6e164d691",
      "name": "List todos",
      "method": "get",
      "path": "/todos",
      "enabled": true,
      "strategy": "single",
      "responses": [
        {
          "id": "03591178-e36c-5f6f-b346-29c8e0d46eb6",
          "label": "All todos",
          "statusCode": 200,
          "bodyType": "json",
          "body": "[\n  {\n    \"id\": 1,\n    \"title\": \"Read the HTTP basics page\",\n    \"done\": true\n  },\n  {\n    \"id\": 2,\n    \"title\": \"Send my first request\",\n    \"done\": false\n  },\n  {\n    \"id\": 3,\n    \"title\": \"Write my first test\",\n    \"done\": false\n  }\n]",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": false,
      "authHeader": "Authorization",
      "description": "Returns every todo.",
      "folder": "Todos"
    },
    {
      "id": "ca7bd896-c049-5915-a2a3-da7bffb5e5e0",
      "name": "Get todo",
      "method": "get",
      "path": "/todos/:id",
      "enabled": true,
      "strategy": "rules",
      "responses": [
        {
          "id": "b59d37ad-2c96-5f79-a152-577fbd89eb78",
          "label": "Not found",
          "statusCode": 404,
          "bodyType": "json",
          "body": "{\n  \"error\": \"not_found\",\n  \"message\": \"No todo with id {{params.id}}\"\n}",
          "headers": {},
          "conditions": [
            {
              "source": "pathParam",
              "key": "id",
              "operator": "equals",
              "value": "404"
            }
          ],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        },
        {
          "id": "687b3ee5-a7c1-5980-ba0a-f305fdca76bd",
          "label": "Found",
          "statusCode": 200,
          "bodyType": "json",
          "body": "{\n  \"id\": {{params.id}},\n  \"title\": \"Todo number {{params.id}}\",\n  \"done\": false\n}",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": false,
      "authHeader": "Authorization",
      "description": "Returns one todo. Ask for id 404 to see the not-found answer.",
      "folder": "Todos"
    },
    {
      "id": "0a2bc482-b2b5-5a5f-a56d-b795571df934",
      "name": "Create todo",
      "method": "post",
      "path": "/todos",
      "enabled": true,
      "strategy": "rules",
      "responses": [
        {
          "id": "420c271e-6e88-5321-a2ec-078263b1158d",
          "label": "Created",
          "statusCode": 201,
          "bodyType": "json",
          "body": "{\n  \"id\": {{randomInt(100,999)}},\n  \"title\": \"{{body.title}}\",\n  \"done\": false,\n  \"createdAt\": \"{{now}}\"\n}",
          "headers": {
            "Location": "/todos/new"
          },
          "conditions": [
            {
              "source": "bodyJson",
              "key": "title",
              "operator": "exists",
              "value": ""
            }
          ],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        },
        {
          "id": "94c323dc-9e39-5956-8d00-1d0d07dac13c",
          "label": "Title missing",
          "statusCode": 400,
          "bodyType": "json",
          "body": "{\n  \"error\": \"validation_failed\",\n  \"message\": \"title is required\"\n}",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": false,
      "authHeader": "Authorization",
      "description": "Creates a todo. The JSON body needs a title.",
      "folder": "Todos"
    },
    {
      "id": "e701c493-dd42-5017-9670-e588f4141757",
      "name": "Update todo",
      "method": "put",
      "path": "/todos/:id",
      "enabled": true,
      "strategy": "single",
      "responses": [
        {
          "id": "24846108-db86-5584-a876-54bcd2856892",
          "label": "Updated",
          "statusCode": 200,
          "bodyType": "json",
          "body": "{\n  \"id\": {{params.id}},\n  \"title\": \"{{body.title}}\",\n  \"done\": {{body.done}}\n}",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": false,
      "authHeader": "Authorization",
      "description": "Replaces a todo and echoes it back.",
      "folder": "Todos"
    },
    {
      "id": "d2ffb2ad-c6a9-585b-8ba5-56a254c6c65d",
      "name": "Delete todo",
      "method": "delete",
      "path": "/todos/:id",
      "enabled": true,
      "strategy": "single",
      "responses": [
        {
          "id": "5f9cabd9-439f-5981-b9e5-815764e25d2a",
          "label": "Deleted",
          "statusCode": 204,
          "bodyType": "none",
          "body": "",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": false,
      "authHeader": "Authorization",
      "description": "Deletes a todo. Answers 204 with no body.",
      "folder": "Todos"
    }
  ]
}
