Forum Discussion

gleung's avatar
gleung
Mentor
11 years ago

Testing REST API locally

I am trying to test the REST API on my local machine (particularly the login method). However, I am running into cross domain issues since I am making the call to the staging environment http://mycommunity.com/restapi/vc/authentication/sessions/login from my local machine.

 

Is there a way to successfully make these calls locally for testing purposes.

 

Thanks

2 Replies

  • PaoloT's avatar
    PaoloT
    Lithium Alumni (Retired)
    11 years ago

    Hi gleung 

     

    you can either try and use a jsonp approach, or you can raise a support ticket and ask our team to configure up your staging environment so that the server returns the cross origin headers (and allow these calls). Please note that the latter configuration is for stage / testing only, as there are security implications in doing so.

     

    Thanks,

     

  • You can also get around cross-site restrictions by editing your hosts file to spoof the domain on your local machine. You'll need to run a local webserver to host your REST API application.