POST call returns "An Entity Name Must Be Provided" response
Hey All,
I am trying to create a user and organization via TW API calls, (not through the Composer).
and everytime I do it, I get "An Entity Name Must Be Provided" response.
Interesting thing is, call works on POSTman but it doesnt work on my node script. I made sure I put headers and everything same with the postman, but still I get "An Entity Name Must Be Provided"
Here is my post call on Node script
app.get('/hey/:name', function (req, res) {
var payload = {
method:'POST',
url: 'https://XXXX.net/Thingworx/Resources/EntityServices/Services/CreateUser?appKey=XXXXXXXXXXXXXXX,
headers: {
'ACCEPT':'application/json',
'Content-Type':'application/json',
'Access-Control-Allow-Origin': '*',
},
data: {
'name':req.params.name,
'password':req.params.name,
'description':req.params.name
}
}
request(payload, function (err,response,body) {
//var data = JSON.parse(body);
//console.log(data);
res.send('Hello '+body)
})
any idea how I can get this working?
Thanks,
Mustafa
