Encapsulate Restful Web Service Request Replies on the server side

Asked

Viewed 41 times

0

Hello,

I developed a Restful Web-Service in PHP using the SLIM framework and an android app to consume its services. It’s working fine, however, the GET request replies, which are returned in JSON format, are fully exposed when I access the service URL directly.

I would like to know how to encapsulate these answers on the server side so that they are recovered only by the client when it is consuming the service.

  • You can create an automatic token to be generated in the application and be validated in the Webservice. Hence the result will only be shown if the token has been validated. A basic example would be to create a token with the date and time of the query and then Webservice will approve this token until as many seconds after.

  • Or, if the sending of the information is passed via GET in a Url, you could create an additional variable, e.g.: &target=app_android and in Webservice check if this variable exists in the Url.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.