---
title: ReadOnly and WriteOnly test
slug: readonly-and-writeonly-test
docTags: 
createdAt: 2026-04-17T07:48:39.600Z
---

{
  "id": "NJsgQat7IPoofW6dTGK4C",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.archbee.com/v2/validation/readonly-writeonly",
    "servers": [
      {
        "url": "https://api.archbee.com/v2/validation/readonly-writeonly",
        "description": "Production server"
      },
      {
        "url": "https://staging-api.archbee.com/v2/validation/readonly-writeonly",
        "description": "Staging server"
      },
      {
        "url": "https://{region}.api.archbee.com/{version}/validation/readonly-writeonly",
        "description": "Regional server with variables"
      }
    ],
    "name": "ReadOnly and WriteOnly test",
    "description": "<p>Tests <code>readOnly</code> and <code>writeOnly</code> property behavior. The request body\nincludes <code>writeOnly</code> fields (password), and the response includes\n<code>readOnly</code> fields (id, createdAt).</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Tests readOnly and writeOnly property behavior",
          "customType": "ReadWriteOnlyTest",
          "schema": [
            {
              "name": "username",
              "kind": "required",
              "type": "string",
              "description": "The username (present in both request and response)",
              "example": "johndoe",
              "minLength": 3,
              "maxLength": 50
            },
            {
              "name": "password",
              "kind": "required",
              "type": "string<password>",
              "writeOnly": true,
              "description": "Password (only in requests, never returned in responses)",
              "example": "SecureP@ss123",
              "format": "password",
              "minLength": 8
            },
            {
              "name": "confirmPassword",
              "kind": "optional",
              "type": "string<password>",
              "writeOnly": true,
              "description": "Must match password (only in requests)",
              "example": "SecureP@ss123",
              "format": "password"
            }
          ],
          "modelRef": "#/components/schemas/ReadWriteOnlyTest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "bearerAuth",
          "name": "bearerAuth",
          "kind": "optional",
          "type": "http",
          "description": "<p>HTTP Bearer token authentication (JWT)</p>",
          "scheme": "bearer"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Object created (readOnly fields populated in response)",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Tests readOnly and writeOnly property behavior",
            "customType": "ReadWriteOnlyTest",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "string<uuid>",
                "readOnly": true,
                "description": "Auto-generated ID (only in responses)",
                "example": "550e8400-e29b-41d4-a716-446655440000",
                "format": "uuid"
              },
              {
                "name": "username",
                "kind": "required",
                "type": "string",
                "description": "The username (present in both request and response)",
                "example": "johndoe",
                "minLength": 3,
                "maxLength": 50
              },
              {
                "name": "createdAt",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "Account creation timestamp (only in responses)",
                "example": "",
                "format": "date-time"
              },
              {
                "name": "lastLoginAt",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "Last login timestamp (only in responses, null if never logged in)",
                "example": "",
                "format": "date-time"
              }
            ],
            "modelRef": "#/components/schemas/ReadWriteOnlyTest",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "KcgRVKClVeKA_jpRbR313",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.archbee.com/v2/validation/readonly-writeonly \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data-raw '{\n     \"username\": \"johndoe\",\n     \"password\": \"SecureP@ss123\"\n     }'"
        },
        {
          "id": "KpYW4OtNnjMTNpttl1HAP",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"username\": \"johndoe\",\n   \"password\": \"SecureP@ss123\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.archbee.com/v2/validation/readonly-writeonly\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "M0Bq0HmDXOWP0dwo6_EYY",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.archbee.com/v2/validation/readonly-writeonly\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"username\": \"johndoe\",\n   \"password\": \"SecureP@ss123\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "0FRow5fT0V08is9oZzSm-",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.archbee.com/v2/validation/readonly-writeonly\"\n\npayload = json.dumps({\n   \"username\": \"johndoe\",\n   \"password\": \"SecureP@ss123\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "KcgRVKClVeKA_jpRbR313"
    },
    "results": {
      "languages": [
        {
          "id": "YlFRAXTdcriUzLnc0t_Jg",
          "language": "200",
          "code": "// Object created (readOnly fields populated in response)\n{\n  \"id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"username\": \"johndoe\",\n  \"createdAt\": \"\",\n  \"lastLoginAt\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "YlFRAXTdcriUzLnc0t_Jg"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}