---
title: Replicate Google subscription within eSuite
slug: docs/demo/replicate-google-subscription-within-esuite
description: Learn how to make a POST request to an API endpoint using curl with this helpful code example. Enhance your understanding of headers for accepting and sending JSON data, while incorporating different parameters in the data payload.
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "oQ1gBhdzFQru_uqLI40Y-",
  "data": {
    "url": "https://api.fictive.com/REST/api/accounts/{accountReference}/subscriptions/native-billing/google",
    "name": "Replicate Google subscription within eSuite",
    "method": "POST",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "accountReference",
          "type": "string",
          "description": "Account reference identifier."
        }
      ],
      "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": "packageName",
              "type": "string",
              "example": "",
              "description": "The purchased subscription name"
            },
            {
              "kind": "optional",
              "name": "googlePlaySubscriptionId",
              "type": "string",
              "example": "",
              "description": "The Google Id of the Subscription"
            },
            {
              "kind": "optional",
              "name": "token",
              "type": "string",
              "example": "",
              "description": "The receipt token"
            },
            {
              "kind": "optional",
              "name": "applicationIdentifier",
              "type": "string",
              "example": "",
              "description": "The Google app identifier"
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.ApplicationLayer.Entities.GooglePurchaseReceiptLite",
          "customType": "FictiveGlobal.Api.Rest.ApplicationLayer.Entities.GooglePurchaseReceiptLite",
          "isExpanded": true,
          "description": "GooglePurchaseReceipt that is used for Session authorization"
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "isExpanded": true,
        "statusCode": "401",
        "description": "• Not Authorized",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will provide the ability to create a subscription against a pre-existing eSuite account that has been purchased via the native Google channel",
    "examples": {
      "languages": [
        {
          "id": "Jj8CTz1UBVp4vY-07XXaV",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/accounts/{accountReference}/subscriptions/native-billing/google \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "f1OJKEwThXCeh6Zs3EgTp",
          "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/accounts/{accountReference}/subscriptions/native-billing/google\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "QzZMa4i-ShqV9az21774q",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/accounts/{accountReference}/subscriptions/native-billing/google\")\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": "XVrIhWKy8-hnNRL6Hst1g",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/accounts/{accountReference}/subscriptions/native-billing/google\"\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": "Jj8CTz1UBVp4vY-07XXaV"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-401",
          "language": "401",
          "code": "// • Not Authorized\n"
        }
      ],
      "selectedLanguageId": "response-0-401"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}