7 Replies Latest reply on Sep 25, 2017 4:48 PM by cpeterson RSS
    adityaku Apprentice

    Json error

    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

      • Re: Json error
        adityaku Apprentice

        Please help us with the error

          • Re: Json error
            aanjan Heavyweight Champ

            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.

            • Re: Json error
              preddy-2 Apprentice

              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

            • Re: Json error
              adityaku Apprentice

              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

                • Re: Json error
                  aanjan Heavyweight Champ

                  You would need to use GetJSON to get the contents. Are you getting an error when using that as well?

                  • Re: Json error
                    cpeterson Newbie

                    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)