cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

REST API request for SQL Query on Thingworx

AR_10604442
4-Participant

REST API request for SQL Query on Thingworx

Hello everyone,

Currently I am working with Thingworx and Javascript. I am trying to do an API request from a SQL Query in Thingworx, having the following data: 

 

Thing:  Test WP

SQL (Query) Service: getTest

Service content:

Select * from public.countries 

no inputs required

output infotable (i changed to json, but got an error, infotable is successfull)

 

Using Postman to try to test it:

GET [Thingworx_Server]Thingworx/Things/Test%20WP/Services/getTest

 

Params:

Accept=application/json
Content-Type=application/json

 

Headers:

appKey: Application Krey created on Thingworx

 

Using GET I got 405 response, if I change it to POST, I got:

<head>
    <title>Unexpected Error</title>
    <script>
        function clickAndDisable(link) {
              link.onclick = function(event) {
                event.preventDefault();
              }
            }
    </script>
</head>

 

Anyone knows how i can fix it?

 

 

5 REPLIES 5

Hello, the API request must be POST. Accept and Content-type are headers, too. Try to put an empty JSON in the POST body.

/ Constantine

I got "500 Internal Server Error"

Share more details about the error pls. Also see if you wrap it aroudn a JS service and that helps. That way you can also output JSON content easily.

Attach your Postman collection file, so that we can check it.

Hi @AR_10604442 ,


I wanted to let you know that there is an open question to you where you have posted a topic. 

If you are in a position to respond to this question, that would be great. It can help you to receive an answer soon.

 

Regards,

Abhi

Announcements


Top Tags