REST Example in Postman to create an Item?

Hello All,

Trying to create an Item in Postman to do it later on in my System but I keep getting Bad Request . Here is my example:

I saw the topic but still did not figure out the right format.
What am I missing?

BTW, I am already logged in

cheers
Ewerton

Also found this one, but even with Form-Data it does not work.

Using application/json as Header

Here is the json: { “default_warehouse”: “Finished Goods - AC”, “item_name”: “TestItemREST”, “item_group”: “Sub Assemblies”, “item_code”: “TestItemREST”}

You are using the wrong format for sending your data.
It takes the format data = {JSON}, not {"data":[{JSON}]}

data={“first_name”: “Robert”}

Check out the REST API help page for more details.

Thanks Ben, I kind of figured it , but how do I put it in Postman? I tried it many ways: using forms, replacing the headers for text/html.

I don’t seem to get it right.

Cheers
Ewerton

I use ARC instead of Postman, but this is how I do it:

I’m forbidden because I haven’t logged in, but it should work.

I use the x-www-form-urlencode Content-Type. You also need to make sure there are not spaces in the data={

Good luck!

3 Likes

It worked in ARC, not sure why not in Postman. Thanks Ben!

Hi EwertonMoreira,

I use Postman and my item JSON looks like this:

{ “item_name”:“Axxess MTN 2G Data”, “item_code”:“M2GD”, “description”:“Axxess MTN 2G Data”, “default_warehouse”:“Stores - VAR”, “is_stock_item”:1, “is_sales_item”:1, “is_purchase_item”:1, “brand”:“MTN”, “has_serial_no”:0 }

Make sure you make the request a POST request and then add this JSON to the form data with key name “data”

this works for me.

regards
Hemant

1 Like

Thanks Hemant. Don’t know why I can’t get it to work with Postman!

@EwertonMoreira In the Body section click on the raw tab and there you will see a dropdown in which you need to opt JSON tab and use the following format of data

{ 
  "item_name" : "Axxess MTN 2G Data", 
  "item_code" : "M2GD", 
  "description" : "Axxess MTN 2G Data", 
  "default_warehouse" : "Stores - VAR", 
  "is_stock_item" : 1,
  "is_sales_item" : 1,
  "is_purchase_item" : 1, 
  "brand" : "MTN", 
  "has_serial_no" : 0 
}