The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Rest API Add to Cart Mandatory Variables

joshboutte
Giga Expert

So I am trying to replicate a RITM from one instances of ServiceNow to another. Basically from the Production Instance to the Test Instance. To do that I plan on using the Rest API to Order an Item from the workflow. I'm trying to test the Rest call from the Rest Explorer by Adding to the Cart, but I keep getting the error Mandatory Variables are required.

This is what I'm sending:

{

  "sysparm_quantity":"1",

  "variables": {

        "requestor":"3D831537784f0b4a401c27afdd0210c728",

        "effectiveDate":"2017-10-31",

        "addModify":"Yes",

        "formCode":"TEST",

        "detailedDescription":"Testing Add to Cart",

        "documentCategory":"ASC - Shopping/Discounts",

        "documentSubCategory_asc":"Diamonds & Jewelry",

        "asg_dctm_asc_c_asc":"Read",

        "asg_dctm_ga_c_asc":"Read",

        "asg_dctm_pnc_c_asc":"Read",

        "eventType":"No",

        "documentSensitivity":"INTERNAL USE ONLY",

        "isEnclave":"No",

        "retentionCode":"MAR10",

        "documentPrivate":"No",

        "formCodeActive":"No",

        "print2Image":"No",

        "udoEnabled":"No",

        "validationService":"No",

        "sendStoreMessage":"No"

  }

}

If I use the Service Catalog to add an item and then perform a GET on the cart my variables are coming back as the items labels instead of name. So it would look something like this:

{

  "sysparm_quantity":"1",

  "variables": {

        "Index/Form Code":"TEST",         ->         variable name is formCode and label is Index/Form Code

        ...

}

}

I'm tried both ways with name and label, but nothing is working. Can someone give me some pointers to what might be keeping this from working?

1 ACCEPTED SOLUTION

joshboutte
Giga Expert

Ok I figured it out. I had it right on my first try. I was able to add an item using a different RITM. I don't know why this RITM is giving me problems. Oh well.


View solution in original post

1 REPLY 1

joshboutte
Giga Expert

Ok I figured it out. I had it right on my first try. I was able to add an item using a different RITM. I don't know why this RITM is giving me problems. Oh well.