---
title: Create a Supplier
slug: docs/demo/create-a-supplier
description: Learn how to make a POST request to the fictive API for creating suppliers using the curl command-line tool. This code example includes headers for accepting and sending JSON data, along with a JSON payload for specifying details like name, status, contac
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "sIFSy8XAPZ3LcQHzQYbXb",
  "data": {
    "url": "https://api.fictive.com/REST/api/suppliers",
    "name": "Create a Supplier",
    "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": "supplierRequest",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "name",
              "type": "string",
              "example": ""
            },
            {
              "kind": "optional",
              "name": "status",
              "type": "string",
              "example": ""
            },
            {
              "kind": "optional",
              "name": "contactEmail",
              "type": "string",
              "example": ""
            },
            {
              "kind": "optional",
              "name": "contactPhone",
              "type": "string",
              "example": ""
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.SupplierRequest",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.SupplierRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "kind": "optional",
                "name": "supplierReference",
                "type": "string",
                "example": ""
              },
              {
                "kind": "optional",
                "name": "name",
                "type": "string",
                "example": ""
              },
              {
                "kind": "optional",
                "name": "status",
                "type": "string",
                "example": ""
              },
              {
                "kind": "optional",
                "name": "contactEmail",
                "type": "string",
                "example": ""
              },
              {
                "kind": "optional",
                "name": "contactPhone",
                "type": "string",
                "example": ""
              }
            ],
            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.SupplierResponse",
            "customType": "FictiveGlobal.Api.Rest.Dtos.v1.SupplierResponse",
            "isExpanded": true
          }
        ],
        "isExpanded": true,
        "statusCode": "201",
        "description": "Created",
        "jsonExample": "{\n  \"supplierReference\": \"001SU3ACFZVKUSJLT3\",\n  \"name\": \"Test Supplier\",\n  \"status\": \"Active\",\n  \"contactEmail\": \"test@test.com\",\n  \"contactPhone\": \"01234567890\"\n}"
      },
      {
        "isExpanded": true,
        "statusCode": "400",
        "description": "Validation error",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "401",
        "description": "Not Authorized",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "404",
        "description": "Not Found",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "409",
        "description": "A Supplier exists with the provided name",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "412",
        "description": "Invalid Status provided",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "500",
        "description": "Internal Server Error",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "Calling this endpoint will create a new Supplier on your eSuite instance",
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/suppliers \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "example-1-javascript",
          "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/suppliers\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/suppliers\")\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": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/suppliers\"\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": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-201",
          "language": "201",
          "code": "{\n  \"supplierReference\": \"001SU3ACFZVKUSJLT3\",\n  \"name\": \"Test Supplier\",\n  \"status\": \"Active\",\n  \"contactEmail\": \"test@test.com\",\n  \"contactPhone\": \"01234567890\"\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Validation error\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Not Authorized\n"
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Not Found\n"
        },
        {
          "id": "response-4-409",
          "language": "409",
          "code": "// A Supplier exists with the provided name\n"
        },
        {
          "id": "response-5-412",
          "language": "412",
          "code": "// Invalid Status provided\n"
        },
        {
          "id": "response-6-500",
          "language": "500",
          "code": "// Internal Server Error\n"
        }
      ],
      "selectedLanguageId": "response-0-201"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}