---
title: Create account and replicate Roku subscriptions
slug: docs/demo/create-account-and-replicate-roku-subscriptions
description: Learn how to use the curl command to make a POST request to an API endpoint with this code example. Find out how to include necessary headers for accepting and sending data in JSON format, and explore the data payload structure featuring fields like rokuT
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "Jf56kVCWXkQZVewtQxI02",
  "data": {
    "url": "https://api.fictive.com/REST/api/native-billing/roku",
    "name": "Create account and replicate Roku subscriptions",
    "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": "request",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "rokuTransactionId",
              "type": "string",
              "example": "",
              "description": "The roku transaction ID that is to be validated."
            },
            {
              "kind": "optional",
              "name": "email",
              "type": "string",
              "example": "",
              "description": "Email address of the customer's Roku billing account."
            },
            {
              "kind": "optional",
              "name": "password",
              "type": "string",
              "example": "",
              "description": "Customer's password."
            },
            {
              "kind": "optional",
              "name": "newAccountDetails",
              "type": "object",
              "schema": [
                {
                  "kind": "optional",
                  "name": "firstName",
                  "type": "string",
                  "example": "",
                  "description": "The customer's first name, as forwarded from Roku's native billing."
                },
                {
                  "kind": "optional",
                  "name": "lastName",
                  "type": "string",
                  "example": "",
                  "description": "The customer's last name, as forwarded from Roku's native billing."
                }
              ],
              "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.RokuNewAccountDetails",
              "customType": "FictiveGlobal.Api.Rest.Dtos.v1.RokuNewAccountDetails",
              "description": "Additional customer details provided by Roku."
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.RokuValidateTransactionRequest",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.RokuValidateTransactionRequest",
          "isExpanded": true,
          "description": "DTO for Roku Validate Transaction API Requests"
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "isExpanded": true,
        "statusCode": "200",
        "description": "OK",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "400",
        "description": "• An error occurred while processing the request",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "401",
        "description": "• Not Authorized",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "500",
        "description": "• Internal Server Error",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will provide the ability to create a \r\n             new account within eSuite whilst simultaneously adding the appropriate Roku subscription that has been purchased via the native Roku channel",
    "examples": {
      "languages": [
        {
          "id": "mYoSGrHB3AtIoXPIWbc91",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/native-billing/roku \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "Yh9YWTXkj_-WGAIPdt_27",
          "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/native-billing/roku\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "WH1V_1Shfp4aVelGeLWfr",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/native-billing/roku\")\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": "Hys01NSpn7te3Emre9jho",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/native-billing/roku\"\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": "mYoSGrHB3AtIoXPIWbc91"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// • An error occurred while processing the request\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// • Not Authorized\n"
        },
        {
          "id": "response-3-500",
          "language": "500",
          "code": "// • Internal Server Error\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}