Problem with creating item to Zoho inventory with POST request
Hello, I am trying to add item to Zoho inventory using nodejs POST request. But I keep getting the following error:
- {"code":4,"message":"Invalid value passed for JSONString"}
Here is the code for the POST request:
- let form = {
- unit: "qty",
- item_type: "inventory",
- product_type: "goods",
- is_taxable: true,
- description: "description",
- attribute_name1: "Small",
- name: "Bags-small",
- rate: 6,
- purchase_rate: 6,
- reorder_level: 5,
- initial_stock: 50,
- initial_stock_rate: 500,
- sku: "SK123",
- upc: 111111111111,
- ean: 111111111112,
- isbn: 111111111113,
- part_number: 111111111114,
- attribute_option_name1: "Small",
- purchase_description: "Purchase description"
- };
- let formData = JSON.stringify(form);
- console.log(formData);
- request({
- headers: {
- 'Authorization': 'Zoho-authtoken d9XXXXXXXXXXXXXXXXXd0f46',
- 'organization_id': '667953382'
- },
- uri: 'https://inventory.zoho.com/api/v1/items?authtoken=d9XXXXXXXXXXXXXXXX0f46&organization_id=6XXXXXXX2',
- body: formData,
- method: 'POST'
- }, function (err, res, body) {
- console.log(body); // get error message here
- });
Although the JSON is valid, I get the same error when trying with Postman. Can you please let me know what I am missing here? Thank you