{
  "mockstudioVersion": 1,
  "id": "686ba87c-f6f8-50d9-9c9e-2b9de898d331",
  "name": "Shop API (sample)",
  "description": "A small shop API with login, a catalog and orders. From learn.dhivalabs.com.",
  "port": 4020,
  "corsEnabled": true,
  "proxyBaseUrl": "",
  "recordProxy": false,
  "globalDelayMs": 0,
  "globalHeaders": {},
  "endpoints": [
    {
      "id": "0f863ebe-70c9-55eb-b1af-5eb8eb18e609",
      "name": "Login",
      "method": "post",
      "path": "/auth/login",
      "enabled": true,
      "strategy": "rules",
      "responses": [
        {
          "id": "c00d586d-5b35-5c90-8fec-2a35a86d9daa",
          "label": "Signed in",
          "statusCode": 200,
          "bodyType": "json",
          "body": "{\n  \"token\": \"demo-{{uuid}}\",\n  \"expiresIn\": 3600,\n  \"user\": {\n    \"id\": 7,\n    \"name\": \"Ada Lovelace\",\n    \"email\": \"{{body.email}}\"\n  }\n}",
          "headers": {},
          "conditions": [
            {
              "source": "bodyJson",
              "key": "email",
              "operator": "equals",
              "value": "ada@example.com"
            },
            {
              "source": "bodyJson",
              "key": "password",
              "operator": "equals",
              "value": "secret123"
            }
          ],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        },
        {
          "id": "0535b80d-5077-5bfb-953b-4ac2b8c4fde2",
          "label": "Wrong email or password",
          "statusCode": 401,
          "bodyType": "json",
          "body": "{\n  \"error\": \"invalid_credentials\",\n  \"message\": \"Email or password is wrong\"\n}",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": false,
      "authHeader": "Authorization",
      "description": "Signs in ada@example.com / secret123 and returns a token. Anything else gets 401.",
      "folder": "Auth"
    },
    {
      "id": "005bc445-232f-5dfe-837c-4ce7a5d3bda1",
      "name": "Current user",
      "method": "get",
      "path": "/me",
      "enabled": true,
      "strategy": "single",
      "responses": [
        {
          "id": "968b264b-8022-5dfe-8881-9e4ce495245a",
          "label": "Profile",
          "statusCode": 200,
          "bodyType": "json",
          "body": "{\n  \"id\": 7,\n  \"name\": \"Ada Lovelace\",\n  \"email\": \"ada@example.com\",\n  \"role\": \"customer\"\n}",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": true,
      "authHeader": "Authorization",
      "description": "Needs an Authorization header.",
      "folder": "Auth"
    },
    {
      "id": "aa591d1d-37ae-5b4c-a316-dd0dc6f4f8c1",
      "name": "List products",
      "method": "get",
      "path": "/products",
      "enabled": true,
      "strategy": "rules",
      "responses": [
        {
          "id": "7b333005-958f-507c-afde-527925aea5d6",
          "label": "Books only",
          "statusCode": 200,
          "bodyType": "json",
          "body": "{\n  \"items\": [\n    {\n      \"id\": 3,\n      \"name\": \"HTTP: The Definitive Guide\",\n      \"category\": \"books\",\n      \"price\": 42.0,\n      \"inStock\": false\n    }\n  ],\n  \"total\": 1\n}",
          "headers": {},
          "conditions": [
            {
              "source": "query",
              "key": "category",
              "operator": "equals",
              "value": "books"
            }
          ],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        },
        {
          "id": "a9ac7d13-f3cd-5e5b-98d6-250895b43c82",
          "label": "Everything",
          "statusCode": 200,
          "bodyType": "json",
          "body": "{\n  \"items\": [\n    {\n      \"id\": 1,\n      \"name\": \"Mechanical keyboard\",\n      \"category\": \"hardware\",\n      \"price\": 89.0,\n      \"inStock\": true\n    },\n    {\n      \"id\": 2,\n      \"name\": \"USB-C hub\",\n      \"category\": \"hardware\",\n      \"price\": 39.5,\n      \"inStock\": true\n    },\n    {\n      \"id\": 3,\n      \"name\": \"HTTP: The Definitive Guide\",\n      \"category\": \"books\",\n      \"price\": 42.0,\n      \"inStock\": false\n    }\n  ],\n  \"total\": 3\n}",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": false,
      "authHeader": "Authorization",
      "description": "All products, or only books with ?category=books.",
      "folder": "Catalog"
    },
    {
      "id": "a8fe4a3f-173a-5ad1-8c1d-1813a15aa53e",
      "name": "Get product",
      "method": "get",
      "path": "/products/:id",
      "enabled": true,
      "strategy": "rules",
      "responses": [
        {
          "id": "88d261af-74bc-5e4a-a498-e6e4e740fd56",
          "label": "Not found",
          "statusCode": 404,
          "bodyType": "json",
          "body": "{\n  \"error\": \"not_found\",\n  \"message\": \"No product with id {{params.id}}\"\n}",
          "headers": {},
          "conditions": [
            {
              "source": "pathParam",
              "key": "id",
              "operator": "equals",
              "value": "999"
            }
          ],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        },
        {
          "id": "9e14f5df-72e2-57f5-987e-2450dbf8c554",
          "label": "Found",
          "statusCode": 200,
          "bodyType": "json",
          "body": "{\n  \"id\": {{params.id}},\n  \"name\": \"Product {{params.id}}\",\n  \"category\": \"hardware\",\n  \"price\": 49.0,\n  \"inStock\": true\n}",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": false,
      "authHeader": "Authorization",
      "description": "One product. Id 999 does not exist.",
      "folder": "Catalog"
    },
    {
      "id": "261b5b3c-7cf8-5451-b3ec-b9e584724b3b",
      "name": "Create order",
      "method": "post",
      "path": "/orders",
      "enabled": true,
      "strategy": "rules",
      "responses": [
        {
          "id": "e2291daf-b780-5e09-8c54-293ce2ab4f92",
          "label": "Quantity too large",
          "statusCode": 422,
          "bodyType": "json",
          "body": "{\n  \"error\": \"quantity_too_large\",\n  \"message\": \"You can order at most 10 of one product\",\n  \"max\": 10\n}",
          "headers": {},
          "conditions": [
            {
              "source": "bodyJson",
              "key": "quantity",
              "operator": "greaterThan",
              "value": "10"
            }
          ],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        },
        {
          "id": "e548d514-b02a-5056-9640-2d3dfdaca11c",
          "label": "Created",
          "statusCode": 201,
          "bodyType": "json",
          "body": "{\n  \"id\": \"ord_{{randomInt(1000,9999)}}\",\n  \"productId\": {{body.productId}},\n  \"quantity\": {{body.quantity}},\n  \"status\": \"pending\",\n  \"createdAt\": \"{{now}}\"\n}",
          "headers": {},
          "conditions": [
            {
              "source": "bodyJson",
              "key": "productId",
              "operator": "exists",
              "value": ""
            },
            {
              "source": "bodyJson",
              "key": "quantity",
              "operator": "exists",
              "value": ""
            }
          ],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        },
        {
          "id": "8b1d28d2-6663-5aff-96c2-660cb6d7925c",
          "label": "Fields missing",
          "statusCode": 400,
          "bodyType": "json",
          "body": "{\n  \"error\": \"validation_failed\",\n  \"message\": \"productId and quantity are required\"\n}",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": true,
      "authHeader": "Authorization",
      "description": "Needs an Authorization header. Rules are checked top to bottom.",
      "folder": "Orders"
    },
    {
      "id": "11d6e9d6-3fa3-5619-b03d-81bbb7c4e090",
      "name": "Get order",
      "method": "get",
      "path": "/orders/:id",
      "enabled": true,
      "strategy": "single",
      "responses": [
        {
          "id": "10d33378-30ff-5b15-9c29-a627909baeaf",
          "label": "Order",
          "statusCode": 200,
          "bodyType": "json",
          "body": "{\n  \"id\": \"{{params.id}}\",\n  \"status\": \"shipped\",\n  \"items\": [\n    { \"productId\": 1, \"name\": \"Mechanical keyboard\", \"quantity\": 1 }\n  ],\n  \"total\": 89.0\n}",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": true,
      "authHeader": "Authorization",
      "description": "",
      "folder": "Orders"
    },
    {
      "id": "f2b9ff3b-6ef3-53dc-9168-c200f266882c",
      "name": "Cancel order",
      "method": "delete",
      "path": "/orders/:id",
      "enabled": true,
      "strategy": "single",
      "responses": [
        {
          "id": "a422c4b2-0a8e-50d4-b4c1-2ec51f63f401",
          "label": "Cancelled",
          "statusCode": 204,
          "bodyType": "none",
          "body": "",
          "headers": {},
          "conditions": [],
          "weight": 1,
          "delayMs": null,
          "fault": "none"
        }
      ],
      "defaultDelayMs": 0,
      "jitterMs": 0,
      "requireAuth": true,
      "authHeader": "Authorization",
      "description": "",
      "folder": "Orders"
    }
  ],
  "flows": [
    {
      "id": "b969ed27-b219-5d75-942e-4915b5bb1b29",
      "name": "Checkout journey",
      "mode": "sequential",
      "virtualUsers": 5,
      "iterations": 10,
      "durationSec": 0,
      "rampUpSec": 2,
      "thinkTimeMs": 100,
      "targetUrl": "",
      "stopOnFailure": true,
      "steps": [
        {
          "id": "b78a14c6-338c-5766-a7f0-4e7c89c07681",
          "name": "Sign in",
          "method": "POST",
          "path": "/auth/login",
          "headers": {
            "Content-Type": "application/json"
          },
          "body": "{\"email\": \"ada@example.com\", \"password\": \"secret123\"}",
          "expectStatus": "200",
          "extract": {
            "token": "body.token"
          },
          "enabled": true
        },
        {
          "id": "85abe455-4eb4-5769-bfcc-b28d727e5c7c",
          "name": "Browse products",
          "method": "GET",
          "path": "/products",
          "headers": {},
          "body": "",
          "expectStatus": "200",
          "extract": {},
          "enabled": true
        },
        {
          "id": "344519f4-50cd-5091-a45a-4352e6aa8f48",
          "name": "Place an order",
          "method": "POST",
          "path": "/orders",
          "headers": {
            "Authorization": "Bearer {{vars.token}}",
            "Content-Type": "application/json"
          },
          "body": "{\"productId\": 1, \"quantity\": {{randomInt(1,5)}}}",
          "expectStatus": "201",
          "extract": {
            "orderId": "body.id"
          },
          "enabled": true
        },
        {
          "id": "6eb26d9b-130f-54a4-980e-da09d65c4492",
          "name": "Check the order",
          "method": "GET",
          "path": "/orders/{{vars.orderId}}",
          "headers": {
            "Authorization": "Bearer {{vars.token}}"
          },
          "body": "",
          "expectStatus": "200",
          "extract": {},
          "enabled": true
        }
      ]
    }
  ]
}
