Forum Discussion

ratnesh's avatar
ratnesh
Lithium Alumni (Retired)
12 years ago

Using GET method of REST API for message post is valid ?

REST API document mentions that "POST" method is allowed to post a message to a board. But did come across during testing that even the GET method runs fine and message is posted.

 

http://community.stage.lithium.com/restapi/vc/boards/id/video_cards/messages/post

 

Was wondering whether it would valid to use GET call.. Using GET call It may solve the cross domain limitation(using jsonp) I am facing in developing a widget on other domain.

 

Thanks,

Ratnesh

4 Replies

  • YuriK's avatar
    YuriK
    Khoros Expert
    12 years ago
    Hey Ratnesh,

    In some of our stage sites we have a configuration enabled that will cause you to be able to make a POST call via GET. In production, however, we never enable this configuration, so your code probably won't work in production.

    There are a few possible solutions though.

    1) Use an endpoint to make the rest call and you can call the endpoint via GET
    2) Work with support to configure the domain you are calling from as a valid origin

    Hope this helps,

    Yuri
  • ratnesh's avatar
    ratnesh
    Lithium Alumni (Retired)
    12 years ago

    Hi Yuri,

     Thanks for the quick response. I have further queries on your reply.

     


    1) Use an endpoint to make the rest call and you can call the endpoint via GET

     

    ==> Do you mean to say call GET from the widget running on other domain? If yes, this would be a cross domain limitation (same origin policy of browser)


    2) Work with support to configure the domain you are calling from as a valid origin

     

    ==> Would this be using CORS configuration ? Would lithium does this kind of configuration of marking a certain origin to alllow cross domain access ? Any such cases if you know would be grealty appreciated....

     

    Thanks,

    Ratnesh

     

  • YuriK's avatar
    YuriK
    Khoros Expert
    12 years ago
    Hey Ratnesh,

    For 1, You said previously that you should be able to solve the cross domain issue if you were able to do a GET (via jsonp). By creating an endpoint, you can make the post request from the endpoint and call the endpoint via GET from your widget.

    For 2, we do have a configuration that Lithium Support can set that can allow cross domain access from specific domains. You will need to open a support request to get this set up.

    Hope this helps,

    Yuri
  • ratnesh's avatar
    ratnesh
    Lithium Alumni (Retired)
    12 years ago
    Thanks Yuri. Much appreciate your feedback. I will check with support team on the point-2.