Below is sample code I tested PostJson on TW9.1.11.
I defined a thing “PostJsonTest” with a service "s1" which has a string parameter "p1".
As you can see, I manually set 5 parameters: header/url/content/username/password. Note that parameter "p1" and its value is put inside content.
Can you refer to this sample then change and test your code accordingly ?
---------------------------
let header = {
"Content-Type" : "application/json"
};
let content = {
"p1" : "aaa"
};
let params = {
proxyScheme: undefined /* STRING */,
headers: header /* JSON */,
ignoreSSLErrors: undefined /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
withCookies: undefined /* BOOLEAN */,
proxyHost: undefined /* STRING */,
url: "http://xxx/Thingworx/Things/PostJsonTest/Services/s1" /* STRING */,
content: content /* JSON */,
timeout: undefined /* NUMBER */,
proxyPort: undefined /* INTEGER */,
password: "xxx" /* STRING */,
domain: undefined /* STRING */,
username: "xxx" /* STRING */
};
// result: JSON
let result = Resources["ContentLoaderFunctions"].PostJSON(params);