---
title: Encodes an identifier from its composite pieces
slug: docs/demo/encodes-an-identifier-from-its-composite-pieces
description: Learn how to use the curl command to perform a POST request to an API endpoint with this code example. The request is made with JSON data, indicated by the headers. The request body includes essential parameters such as "referenceType" and "id". Master th
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "OYHfR4UHHrC6401MoQsJP",
  "data": {
    "url": "https://api.fictive.com/REST/api/resources",
    "name": "Encodes an identifier from its composite pieces",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "kind": "optional",
          "name": "X-TokenId",
          "type": "string",
          "description": "The eSuite Token Id"
        },
        {
          "kind": "optional",
          "name": "X-SessionId",
          "type": "string",
          "description": "The eSuite Session Id"
        },
        {
          "kind": "required",
          "name": "X-Version",
          "type": "string",
          "description": "The eSuite Version"
        },
        {
          "kind": "optional",
          "name": "Origin",
          "type": "string",
          "description": "The eSuite Origin"
        }
      ],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "components",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "referenceType",
              "type": "string",
              "example": "",
              "description": "The code for the reference type. See <see cref=\"!:http://confluence.FictiveGlobal.com/display/DEVDOC/Resource+Reference+Codes\">this table on Confluence</see>\r\n            to get the right code."
            },
            {
              "kind": "optional",
              "name": "id",
              "type": "integer<int64>",
              "example": 0,
              "description": "The internal ID to encode."
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.ReferenceCodec.ReferenceComponents",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.ReferenceCodec.ReferenceComponents",
          "isExpanded": true,
          "description": "Defines a request to encode a resource identifier."
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "schema": [
          {
            "kind": "optional",
            "type": "string",
            "isExpanded": true,
            "description": "OK"
          }
        ],
        "isExpanded": true,
        "statusCode": "200",
        "description": "OK",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will provide the ability to encode a numeric reference into an alphanumeric string.\r\n              This endpoint will not be available in production and is provided to aid testing and integration",
    "examples": {
      "languages": [
        {
          "id": "6QDkq_YKNNSxVA_BACwYe",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/resources \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "kD2pl_wywHMwcbctgkklF",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"x-version\", \"string\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.fictive.com/REST/api/resources\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "cuBhe4ZlBdH7kLHgfKr0M",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/resources\")\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[\"x-version\"] = \"string\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "Owp2RFVGncptEocBobtoV",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/resources\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-version': 'string'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "6QDkq_YKNNSxVA_BACwYe"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n\"\""
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}