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

how can i Invoking a service by REST API ?

ikhalil
1-Newbie

how can i Invoking a service by REST API ?

I am facing a problem. can't invoke a service using REST API. I wanna execute a service while REST API is called. i try to do this by this link http://MyServer//Thingworx/Things/UtilityThing/Services/CreateThings . But this is not working. Is there any other way to do this.

1 ACCEPTED SOLUTION

Accepted Solutions

Thank you every one. The problem is solved.

View solution in original post

7 REPLIES 7
paic
1-Newbie
(To:ikhalil)

If you are doing this externally it has to be a POST

There is a lot of good content available on the REST API in this forum and on support.ptc.com, I recommend you do a search.

Also there is a dedicated section in the Java Doc.

mhollenbach
5-Regular Member
(To:ikhalil)

Don't forget to check the box in the PlatformSubsystem under the Configuration section for "Allow Request Method Switch". If you don't do this all of your POSTs will be GETs instead and prevent you from exercising any services.

Hello Meghan,

My understanding was that "Allow Request Method Switch" allows you to replace POST with GET + "&method=post" parameter, which is outdated and discouraged practice left mainly for compatibility with legacy clients which couldn't send HTTP POST.

Please correct me if I'm wrong.

/ Constantine

mhollenbach
5-Regular Member
(To:ckulak)

Clarification: This is only if you are directly invoking the request within a browser and not from an external source.

ckulak
1-Newbie
(To:ikhalil)

Hello Ibrahim,

That's how you do it:

post-request.png

Regards,

Constantine

Thank you every one. The problem is solved.

I just added appKey with the link.

Announcements