Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi,
we are trying to get the content from the url using POSTJSON service. used the below code:
var params = {
proxyScheme: undefined /* STRING */,
headers: undefined /* JSON */,
ignoreSSLErrors: undefined /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
withCookies: undefined /* BOOLEAN */,
proxyHost: undefined /* STRING */,
url: "https://public-api.wordpress.com/rest/v1/sites/www.davidjmcclelland.com/posts/" /* STRING */,
content: undefined /* JSON */,
timeout: undefined /* NUMBER */,
proxyPort: undefined /* INTEGER */,
password: undefined /* STRING */,
domain: undefined /* STRING */,
username: undefined /* STRING */
};
// result: JSON
var result = Resources["ContentLoaderFunctions"].PostJSON(params);
But we are getting the error while running the service.
The error is given below :
Error executing service
Wrapped java.net.UnknownHostException: public-api.wordpress.com Cause: public-api.wordpress.com
Thanks,
Aditya Kumar
Please help us with the error
Aditya, what version of ThingWorx are you using? There was a fix released recently on versions 6.5.8, 6.6.3 and 7.0.1 regarding not getting any header information back when using PostJSON; but you still should not be getting the error message you're currently seeing. I tested this out on 6.5.9, and I didn't get any errors.
Hi Ravi,
We are using 6.5.0 version.
Thanks,
Aditya Kumar
Hi Aditya,
I tried your code with TW 6.0. I am not getting any error. But the result of that post is null.
I tried with GetJson(), then I could get the data (nearly 129 posts.)
Thank you.
With B/R,
Praveen.B
Hi,
Is this a problem of proxy or what, due to which i am getting an error?
Error executing service
Wrapped java.net.UnknownHostException: public-api.wordpress.com Cause: public-api.wordpress.com
Is there a way to bypass the proxy or the host exception?
Thanks,
Aditya
You would need to use GetJSON to get the contents. Are you getting an error when using that as well?
I had set a Proxy server on my server temporarily to download applications. Disabling the proxy does not clear the Windows environment variable HTTP_PROXY. I had to delete the Environment variable to bypass the proxy errors (Unkown host because my REST server was not on a node known to the proxy server)