Hi all, I am new to working with suitetalkapi and ...
# suitetalkapi
a
Hi all, I am new to working with suitetalkapi and I am trying to use the rest services to add a non-inventory resale item. I tried following the sample they provide but I always end up with "title":"Bad Request","status":400,"o:errorDetails":[{"detail":"Invalid content in the request body.","o:errorCode":"INVALID_CONTENT"}]. It doesn't tell me what it didn't like about the content, just that it was invalid. Any insights would be appreciated. I am able to query and update the non-inventory resale items, just can't add a new one. Thanks.
c
Share your payload
a
Copy code
{
  "expenseaccount": "1100",
  "shoppingproductfeed": "F",
  "generateaccruals": "F",
  "isonline": "F",
  "costcategory": "1",
  "lastpurchaseprice": "0",
  "links": [],
  "costestimatetype": "LASTPURCHPRICE",
  "purchaseunit": "1",
  "weight": "0",
  "islotitem": "F",
  "subsidiary": "1",
  "includechildren": "T",
  "isdonationitem": "F",
  "nextagproductfeed": "F",
  "shopzillaproductfeed": "F",
  "storedescription": "Song: Fearless DD",
  "matchbilltoreceipt": "F",
  "usemarginalrates": "F",
  "shippingcost": "0",
  "saleunit": "19",
  "isinactive": "F",
  "isserialitem": "F",
  "dontshowprice": "F",
  "froogleproductfeed": "F",
  "fxcost": "1.99",
  "description": "Test Item",
  "incomeaccount": "1044",
  "itemid": "S4007781",
  "subtype": "Resale",
  "isphantom": "F",
  "isfulfillable": "T",
  "unitstype": "1",
  "consumptionunit": "1",
  "printitems": "F",
  "enforceminqtyinternally": "T",
  "seasonaldemand": "F",
  "copydescription": "F",
  "cost": "2.091",
  "showdefaultdonationamount": "F",
  "excludefromsitemap": "F",
  "weightunits": "per EA",
  "yahooproductfeed": "F",
  "averagecost": "0",
  "shipindividually": "F",
  "outofstockbehavior": "DEFAULT",
  "itemtype": "NonInvtPart",
  "displayname": "Test Item",
  "isdropshipitem": "F",
  "isspecialorderitem": "F",
  "fullname": "S4007781"
}
I did find where I incorrectly had two commas together that probably caused the invalid content. After correcting that it gets a 500 return code with "title":"Internal Server Error","status":500,"o:errorDetails":[{"detail":"An unexpected error occurred. Error ID: llleu4t72m4k41ldp769","o:errorCode":"UNEXPECTED_ERROR"}]}
b
your request body doesnt look like it matches the item schema. you want to take a look at the metadata or the REST API Browser
or at the very least do a get on an existing item to see what it should look like
a
I did a get on an existing item and then removed the "id" field and changed the description. That is what I was attempting to add. I'll take a closer look at the metadata. Thanks!
b
what did the get look like
the request you shared is doing booleans wrong, has non supported fields and is representing record refs as strings
all things that a get does not do
a
Thanks, what I was starting with was retrieved with a query (select * from item where itemid=?). When I use the /services/rest/query/v1/suiteql service, I am getting the full correct format. That should give me a starting format to work on tomorrow. Thank you!
b
you really want get operation instead
a
I used the GET operation to get an existing item. The item has several links with an href that include the id of the item. Not knowing what the new item's id will be, not sure how I populate those. I am getting "title":"Bad Request","status":400,"o:errorDetails":[{"detail":"Invalid value for the resource or sub-resource field 'subsidiary'. Provide a valid value.","o:errorPath":"subsidiary","o:errorCode":"INVALID_VALUE"}]. If I remove "subsidiary" then it gets 500. This is what the GET has for subsidiary: "subsidiary":{"links":[{"rel":"self","href":"https://XXXXXX.suitetalk.api.netsuite.com/services/rest/record/v1/noninventoryresaleitem/77616/subsidiary"}]}, I tried "subsidiary":{} and "subsidiary":{"links":[]} but still get the same 400 error for invalid subsidiary value.
c
NetSuite will create the internal ID when it creates the item, you don't specify it. "Page: subsidiaries" in global search in NetSuite. Pick one, use its internal ID in your request.
Is this your first NetSuite dev project?
a
Yes, this is my first Netsuite dev project. I mainly come from a Spring Boot/React background.
When I leave the subsidiary the same as it was from the GET, it says invalid value for subsidiary
I've gotten it to the point where this is the error now: Please enter value(s) for: Tax Schedule. When I perform the GET on an existing item the only thing with tax is : "custitem_ava_taxcode":"DM040200" and I included that in the ADD request
b
a
So if SuiteTax is not enabled, we can't use REST web services to add items?
b
correct
a
Thanks for the info