REST API- Product Inventory Open API

Aijaz1
Tera Contributor

Hi, I was exploring product inventory open API in  San Diego and wanted to create some order so I went to REST API Explorer ,set the namespace to "sn_prd_invt" ,set the POST http method and added the payload in request body which I copied from this website "docs.servicenow.com/bundle/sandiego-application-development/page/integrate/inbound-rest/concept/prod..." .Attaching the payload that I used in the request body for reference

{
   "pid": "demoInventory",
   "description": "inventory description",
   "isBundle": false,
   "name": "Voice Over IP Basic instance for Jean",
   "productOffering": {
      "id": "69017a0f536520103b6bddeeff7b127d",
      "name": "Premium SD-WAN Offering",
      "@referredType": "ProductOffering"
   },
   "productCharacteristic": [
      {
         "name": "CPE Type",
         "valueType": "choice",
         "value": "Virtual"
      },
      {
         "name": "Routing",
         "valueType": "choice",
         "value": "Premium"
      }
   ],
   "productRelationship": [
      {
         "productId": "7e6d13f45b5620102dff5e92dc81c787",
         "relationshipType": "child"
      }
   ],
   "relatedParty": [
      {
         "id": "eaf68911c35420105252716b7d40ddde",
         "name": "Sally Thomas",
         "role": "User",
         "@type": "RelatedParty",
         "@referredType": "CustomerContact"
      },
      {
         "id": "ffc68911c35420105252716b7d40dd55",
         "name": "Funco Intl",
         "@type": "RelatedParty",
         "@referredType": "Customer"
      }
   ],
   "productSpecification": {
      "id": "cfe5ef6a53702010cd6dddeeff7b12f6",
      "@referredType": "ProductSpecification",
      "version": "1"
   },
   "id": "3ac715c6745d8150f877ca57242ff97a"
}

 I am getting the below error while running this payload

{
  "code": 21,
  "reason": "Invalid payload: Request body missing",
  "message": "Invalid payload: Request body missing",
  "details": [
    {
      "message": "Invalid payload: Request body missing",
      "datapath": ""
    }
  ]
}

Can anyone help me with this issue.

Thanks

 

NOTE: Demo data is already installed in my PDI.

5 REPLIES 5

Segin R
Tera Contributor

I too had the same issue; please try the following request it works for me.

 [

   {
      "pid": "PO-456",
      "description": "inventory description",
      "isBundle": false,
      "name": "Voice Over IP Basic instance for Jean",
      "productOffering": {
         "@referredType": "ProductOffering",
         "name": "Premium Unlimited mobile plan",
         "id": "de33104fc30020105252716b7d40ddd0"
      },
      "productCharacteristic": [],
      "productRelationship": [
         {
            "productId": "5e91bc3577b301108e191e599a5a9959",
            "relationshipType": "child"
         }
      ],
      "realizingService": {
         "id": "25913c3577b301108e191e599a5a99d5",
         "relationshipType": "child"
      },
      "realizingResource": {
         "id": "3d917c3577b301108e191e599a5a99b2",
         "relationshipType": "child"
      },
      "relatedParty": [
         {
            "@referredType": "CustomerContact",
            "@type": "RelatedParty",
            "name": "Sally Thomas",
            "id": "eaf68911c35420105252716b7d40ddde"
         },
         {
            "@referredType": "Customer",
            "@type": "RelatedParty",
            "name": "Funco Intl",
            "id": "ffc68911c35420105252716b7d40dd55"
         }
      ],
      "productSpecification": {
         "@referredType": "ProductSpecification",
         "@type": null,
         "name": 'Mobile Plan',
         "id": "3ee1fdb1c3331010d216b5183c40dd81",
         "internalVersion": "1"
      },
      "bundle": false
   }
]