function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
motti10motti10 

How can I create a new Product with REST call?

I am trying to create a new Product with REST (using Groovy)

 

 

product= [
"ProductName":"test",
]

def jsonString = JSONObject.fromObject(product).toString(2)

 

http.request( POST ) {
contentType = JSON
    uri.path = '/services/data/v20.0/sobjects/Product/'
uri.query = [_HttpMethod:'POST']
 
 send JSON, jsonString
  headers.'Authorization' = "OAuth $accessToken"

 

 
 }
}



 

I get

INFO - {
 "faultcode ": "Groovy Exception",
 "faultstring": "Bad Request"
}