- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
I am using the node js API with the following request and the category id is not getting populated when creating a new item.
Notice in the json that I am using "categoryid" instead of what is called out in the api documentation as "category_id." Whenever I use "category_id" the request fails and the item is not created. However, when I use "categoryid" the request is made and the item is created; however, the category id is not assigned.
How can I properly create an item and assign a category using the API?
var item_options = {
method : "POST",
url : "https://connect.squareup.com/v1/<hidden>/items",
json : {
"name": arr_line[file_settings['name']].replace(/\"/g,""),
"categoryid": category,
"variations" : [{
"name": variation_name,
"sku":sku,
"pricing_type":"FIXED_PRICING",
"price_money":{
"currency_code":"USD",
"amount":price*100
}
}]
},
headers: {
'Authorization': 'Bearer <hidden>',
'Content-Type': 'application/json'
}
}
request(item_options)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
I'd love to help you as soon as possible but to make 100% that I am getting you the right information, I'm going to run this by our developer team. I'll follow up once I have a little more information for you!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
Thanks for waiting! Sorry about the delay, I was able to speak with our developer team and they let me know the following:
Our API doesn't look at unknown fields (like categoryId), so those fields get discarded.
So we can keep digging into this: Does the result of this API endpoint (GET /v1/<location>/categories) return an entry that has this category_id? What is the error message returned from the server when you make the POST /v1/<location_id>/items call?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report