I think the answer is 'NO', but I really do not know the answer to this. Is there a way to find undocumented REST functions on a REST API?
Thank you
Strange question, but the only answer is NO.
Or bruteforce, but, I guess, you don't want to do it.
It depends on...
If the service fulfills the REST constraints (uniform interface / HATEOAS in this case), then you can find every "function" as hyperlinks in the HTTP responses.
If the service does not fulfill the REST constraints, then we aren't talking about REST just a CRUDish RPC.
Related
Oftentimes when looking to design a REST API I see a common pattern of /resourceA/{id}/resourceThatBelongsToA.
Is it ok to do /resourceA/resourcesThatBelongToA when designing an API?
Reallife example
Say I have a web application similar to StackOverflow. There are questions, and each question has a status of accepted or not accepted.
I expose an endpoint /questions/{id}/status so that users can determine whether or not a question has an accepted answer.
I then run into the problem of wanting to discover all questions that have an accepted answer. I then define an endpoint /questions/statuses?status=accepted. This endpoint, when given no query parameters, will list all the statuses of all questions (with reasonable limits on the amount of statuses return, say 100). However, when given a filter of status type, I can determine all questions that have an answer that was accepted.
To me, this seems like a practical design that fits the use case well.
Is this an acceptable pattern to use or is there something more suitable?
Is it ok to do /resourceA/resourcesThatBelongToA when designing an API?
Yes.
REST doesn't care what spelling you use for your identifiers.
REST doesn't care how you organize your resource hierarchy.
Is this an acceptable pattern to use or is there something more suitable?
The heuristic I recommend is "would you do it this way with a web site?" If the answer is yes, then you are on the right track.
REST APIs look good when you have a unique id for the parent resource you are dealing with. /questions/{id} is good if you want to get the question resource with the particular id. But if you don't have a unique ID and if the response is going to be a set of resources, then it is just a filter applied to the parent resource.
So for your case, the API can be
/questions?status=accepted
If you want the api consumers to get the flexibility for choosing limits, you can use a query parameter limit for it.
/questions?status=accepted&limit=10
I want to design System API which is going to connect with REST service using RAML for Healthcare domain.
Backend Rest service will have GET/POST requests.
GET/POST request will usually serve getCollection/getById/getByName.
How can I start approaching designing RAML?
Which is the best and standard way to do it?
anyone can help me with the below items.
The naming convention used to name for Process/System/Experience API's.
URI design
any other architectural suggestions if you want to add.
Thanks,
Vijay D
Regarding RAML I would suggest below tutorials are very useful and are well explained with exmaples
https://raml.org/developers/raml-100-tutorial
https://raml.org/developers/raml-200-tutorial
You can also look at raml spec at below url
https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md
Regarding naming convention and design. These are quite broad topics. I would suggest below book which is available from mulesoft to download is a good place to start.
https://www.mulesoft.com/lp/ebook/api/restbook
Also Here is the link to ebook resources and on bottom you can see all resources section which can help you with different areas you looking to explore.
https://www.mulesoft.com/ebook
Can anyone please tell me if Sabre has REST API equivalent to SOAP SabreCommandLLS Service with Action SabreCommandLLSRQ? If Sabre has developed the same, where I can find its documentation?
Thanks in advance.
No, there' s not a REST equivalent service.
First of all, what kind of transaction are you trying to execute using Sabrecommand ?
Just to remember, use of Sabrecommand it is do not considered a good practice, you should try to avoid use this kind of approach, you should use always services (REST/SOAP) instead of Sabrecommand.
Second of all, Sabrecommand is not supported by REST and the reason is obvious, is do not recommended to use Sabrecommand.
I am struggling with the concept SOA. Lets say there is a big project which contains a lot of specific business logic and resources. From what I've found SOAP and REST makes sense, SOAP for the business logic part and REST for the resources/CRUD part.
The idea that I have in mind is to use SOAP as a public entry-point and use the REST as an internal API for SOAP (because it should not have business logic), this way I can utilize the strength of both structures.
The problem here is that writing detail/overview requests will probably be in REST and SOAP services, which isn't good for maintenance.
Should mixing SOAP and REST be avoided or can they be used in the proper way of how I described it?
EDIT I will try to make a more specific case. I also came across a good article http://www.infoq.com/articles/tilkov-rest-doubts. Which will resolve a lot of problems with using business logic in REST, by renaming the models differently.
For example if you have an order with products and you have discount on it can be calculated after (creating) POSTing products to an /order URL for example. And the discount is visible after GETing the product on /order URL. This fits perfectly in REST.
However when for some reason you can't have product x and y in the same order, this seems a bit difficult to do in a REST service. Because you will have to give proper error message like 'x and y can't be in one order', this is exposing business logic and seems to fit better in SOAP. Is there a way to do this is REST and if so, is it better to do use REST in this case?
A broad question, perhaps too broad. Of course it depends on what you are building. If you provide some more details, platform, targeting what kind of devices, etc you will get a better answer.
However, consider building RESTful api's for everything, public + internal. I'd suggest checking out ServiceStack https://github.com/ServiceStack/ServiceStack/wiki/Why-Servicestack docs which discuss an approach for api's. Even if you don't use their toolset, the concepts will help you build your own web api's.
I want to ask a question about the RESTful. I want to click a URL and make a RESTful call. However, I don't know what kind of information do I need to send with the URL, cookies?http header? Can anyone help me? Thank you.
If you use jQuery, you can use proper RESTful HTTP requests (PUT/DELETE as well as GET/POST). Have a look at jQuery.ajax() for details.
I'd also suggest you get a bit more familiar with the principles behind REST. The O'Reilly Restful Web Services book is quite a good one for that, although some of the framework specific details are a little out of date.
It's not really possible to make Restfull api calls with a browser. Especially not with links.
With links, you only can make GET requests. To make POST requests, you would have to use a form.
PUT and DELETE aren't even possible at all.
If you are using windows, you can look at HTTP Fiddler 2, which can build arbitrary requests.
Further more, it depends on the API itself what you should send. We cannot help you unless you give some more details about what kind of request you want to make.