I am writing REST APIs and will be hosting this service in Backendless. However i am not able to find anyways to get access to the parameters sent in URI. is there a way to get the Path variables? Couldnt get any hit in google or this forum.
For example,
lets say the URI is 1. <baseURI>/Directory/<phoneNumber>
This call with the magic of backendless will reach the "getDirectory’ method.
2. <baseURI>/Directory/<phoneNumber>/Call (agreed, this doesn’t adhere to REST convention, but using it for sample sake)
But inside these method, i am not sure how to get the “phoneNumber”. (With JAX-RS, i would have used the GET and Path annotations and accessed)
Could you please suggest how do i go about this?
thanks!
The routes generated by Backendless will map data from REST request to the method arguments in your Java or JS code. See the details here:
https://backendless.com/documentation/business-logic/java/apieng_rest_routes.htm
Or better yet, go through the Quick Start to experience it first hand:
https://backendless.com/documentation/business-logic/java/apieng_quick_start_java.htm
Mark
Hi, Thanks for the links. However I have already gone through these pages but my requirement is not getting solved by them.
Please see that the “index” in my examples in inside the URL. and not as a query parameter:
- <baseURI>/Directory/<phoneNumber>
- <baseURI>/Directory/<phoneNumber>/Call
phoneNumber is replaced by the numerical phone number and varies in invocation. phoneNumber will be the identifier of each row in the table “Directory”.
As you can see from the second example, I would like to retrieve the phoneNumber and then perform ‘Call’ (or any operation) on that row item. As specified, the url doesn’t pass the phone number as a query item.
May be I missing something here, but could you please elaborate?
thank you.
Is your service implemented in Java or JS?
What does the method signature look like where you need to get “phoneNumber” ?