The payload is not valid JSON Error

PrudhviY
Tera Contributor

Hi - I am trying to Test one the Scripted REST API from REST API Explorer but I am getting below error

The payload is not valid JSON

 We want to create Product Specification and at the same time Product offering for the same Product specification (creating relationship for the product spec and product offer. Please find the below payload I am using, please let me know if there something is missing.

 

{
"productSpecification": [
{
"name":"NetApp on Equinix Metal Storage Commitment: Extreme",
"display_name":"NetApp on Equinix Metal Storage Commitment: Extreme",
"specification_category": "storage / Storage",
"start_date": "2024-09-01",
"specification_type":"goods",
"external_id":"1-006-634",
"u_billable": "false",
"description": "NetApp on Equinix Metal Storage Commitment: Extreme",
"status": "published",
"code": "1-006-634",
"specification_code": "1006634",
"u_sales_uom": "Metal",
"product_code": "1006634",
"specification_category": "storage / Storage",
"product_line": "Metal"
}
],
“productOffering”: [
{
“name”: “NetApp on Equinix Metal Storage Commitment: Offering”,
"display_name":"NetApp on Equinix Metal Storage Commitment: Offering”,
“offering_type”: “product”,
“description”: “NetApp on Equinix Metal Storage Commitment: Offering”,
“state”: “published”,
“distribution_channel”:”EQP”,
“code”:"1-006-605”,
“contract_term”:”12”,
“start_date”:”2023-09-01"
}
]
}

1 ACCEPTED SOLUTION

Rajesh Chopade1
Mega Sage

Hi @PrudhviY 

The issue you're encountering is due to incorrect quotation marks in your JSON payload. JSON requires that you use straight quotes (") for strings, but in your payload, you have curly quotes (“”) in the productOffering section. Additionally, some fields are duplicated, such as specification_category, which needs to be corrected.

Try below JSON once :

 

{
  "productSpecification": [
    {
      "name": "NetApp on Equinix Metal Storage Commitment: Extreme",
      "display_name": "NetApp on Equinix Metal Storage Commitment: Extreme",
      "specification_category": "storage / Storage",
      "start_date": "2024-09-01",
      "specification_type": "goods",
      "external_id": "1-006-634",
      "u_billable": "false",
      "description": "NetApp on Equinix Metal Storage Commitment: Extreme",
      "status": "published",
      "code": "1-006-634",
      "specification_code": "1006634",
      "u_sales_uom": "Metal",
      "product_code": "1006634",
      "product_line": "Metal"
    }
  ],
  "productOffering": [
    {
      "name": "NetApp on Equinix Metal Storage Commitment: Offering",
      "display_name": "NetApp on Equinix Metal Storage Commitment: Offering",
      "offering_type": "product",
      "description": "NetApp on Equinix Metal Storage Commitment: Offering",
      "state": "published",
      "distribution_channel": "EQP",
      "code": "1-006-605",
      "contract_term": "12",
      "start_date": "2023-09-01"
    }
  ]
}

 

 

i hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.

thank you

rajesh

View solution in original post

1 REPLY 1

Rajesh Chopade1
Mega Sage

Hi @PrudhviY 

The issue you're encountering is due to incorrect quotation marks in your JSON payload. JSON requires that you use straight quotes (") for strings, but in your payload, you have curly quotes (“”) in the productOffering section. Additionally, some fields are duplicated, such as specification_category, which needs to be corrected.

Try below JSON once :

 

{
  "productSpecification": [
    {
      "name": "NetApp on Equinix Metal Storage Commitment: Extreme",
      "display_name": "NetApp on Equinix Metal Storage Commitment: Extreme",
      "specification_category": "storage / Storage",
      "start_date": "2024-09-01",
      "specification_type": "goods",
      "external_id": "1-006-634",
      "u_billable": "false",
      "description": "NetApp on Equinix Metal Storage Commitment: Extreme",
      "status": "published",
      "code": "1-006-634",
      "specification_code": "1006634",
      "u_sales_uom": "Metal",
      "product_code": "1006634",
      "product_line": "Metal"
    }
  ],
  "productOffering": [
    {
      "name": "NetApp on Equinix Metal Storage Commitment: Offering",
      "display_name": "NetApp on Equinix Metal Storage Commitment: Offering",
      "offering_type": "product",
      "description": "NetApp on Equinix Metal Storage Commitment: Offering",
      "state": "published",
      "distribution_channel": "EQP",
      "code": "1-006-605",
      "contract_term": "12",
      "start_date": "2023-09-01"
    }
  ]
}

 

 

i hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.

thank you

rajesh