Tag Info

New answers tagged

0

It sounds like you have a tree structure. And the search criteria just decides which node of the tree should be used as a root node where the search for children should start. I would create the service based on that. What you want to get from the service are children that match the text. GET /myservice/api/v1/children?search={text} but there are other ...


2

First As Per RFC 3986 §3.4 (Uniform Resource Identifiers § (Syntax Components)|Query 3.4 Query The query component contains non-hierarchical data that, along with data in the path component (Section 3.3), serves to identify a resource within the scope of the URI's scheme and naming authority (if any). Query components are for ...


2

Short answer: you can't. If it is on the client there is no way you can avoid this scenario if the 'attacker' is dedicated. There is simply no way you can 'force' your application to talk only to your server as the user can intercept and tamper with the communication, forcing it to other servers and returning canned responses. You could make it harder for ...


0

Recently I wrote a detailed post on these and some related questions. Should I return a status code and a message in a response? Yes, but message should not contain exception message unless that message was crafted specifically to be shown to end user. Since you talk about DomainException, which probably should be quite specific about explaining what ...


0

I prefer to do something like this, 1.the rest end point will receive an request with data then, 2.business service class is called with the data Validate the data if invalid throw an exception with proper description, eg: throw new InvalidArgumentException("invalid objet Id"); On controller if above exception is thrown then return 400 bad request with ...


2

Use GET. The fact that the data changes each time a client accesses it is not a reason not to use GET. You are not POSTing any data to the web server, you are merely GETting the current state of the resource. That state may be constantly changing, for example GET /currenttime.html will constantly change each time you request it. There isn't anything in the ...


0

The API should do whatever it can to give the application the necessary information how to proceed. But for the user, the message is most likely: None - for things like updates, prefetch etc. or where retrying helps. Tell them "it didn't work". Tell them "it didn't work, it might work later". Tell them "it didn't work, here's what you can do to fix it" ...


3

Consider removing empty or null values. If a property is optional or has an empty or null value, consider dropping the property from the JSON, unless there's a strong semantic reason for its existence. { "volume": 10, // Even though the "balance" property's value is zero, it should be left in, // since "0" signifies "even balance" (the value could ...


1

You are facing a trade-off between two design principles: first, simplicity/consistency: your original approach has the advantage that the names and structure correspond better to your server-side structures, what saves you some mapping effort. For example, imagine you introduce a color attribute into the Group resource later. So your first approach now ...


2

A lot of questions of this kind depend heavily on the actual business domain, and it's not clear that we have enough information to make a good decision. any rebind is treated as non-normal situation This comment suggests that it may make the most sense to send back a error response (e.g. 400 Bad Request) with a description of the reason you're not ...


1

The scenario you describe assumes that when the software is re-installed on a device, that your system will recognize that device as having been seen before. This will only happen if, as part of the registration, the device must send some hardware identification. If you don't use such pre-existing hardware identifications, but you assign an ID after ...


1

This is a lot like asking why we have both a username and a password for all our regular internet accounts, when arguably just a password is sufficient. The first reason is actually contained in your question: Actually I would considered using a single API ID is more secure - since when you change , it is more hard to identify the client (as there is no ...


1

There are basically two different questions in one. Let me simplify and rephrase them: 1. If you have userId once as authentication info and once as a part of a data object which one should win? None of them should win. These are two different userIds one is user performing the action another is the data object user as a subject of the action. Think of ...


2

I've seen good APIs designed both ways. On the one hand, providing the userId in authentication and the URL seems redundant. On the other hand, it could be more consistent to have an explicit Id in the URL if there are also ways for one user to look at public data of another user or you are using the same or a similar API in clients that need to get data ...


0

Your GET /news essentially hides with what resources are you working with behind authentication info (which is usually transferred to the server using sessionId). This isn't RESTful, as you should explicitly define what resources are you working with in the URL. Correct version is: GET /news?userId=:userId Even in this case you use the authentication ...


0

The key issue here is, how is business logic invoked transparently when a REST call is made? This is a problem that is not directly addressed by REST. I have solved this by creating my own data management layer over a persistence provider such as JPA. Using a meta model with custom annotations, we can invoke the appropriate business logic when the entity ...


-1

What is the function of the URL/URI/IRI as a "key" name? The answer can be found in RFC 5988 (Chapter 5.3. Relation Type): Note that extension relation types are REQUIRED to be absolute URIs... Simply put, the "keys" you are referring to are called "relations" and in order to be uniquely identified, you can either use any of the standardized ones ...


0

I would possibly do something similar to how Microsoft deals with choosing pages to print. An example of this is: To show user 3 ...?show=3 To show all users from 10-50 ...?show=10-50 To show user 1 to 3 and 5 and 10 to 20 ...?show=1-3,5,10-20 It gives complete freedom and can be developed quite easily.


0

Personally, I'd rather not use a separate document store service and document id, but a URL to access the documents (with proper header authentication). With this approach you won't need other services to rely on the document service rather it could just use the full URL to access the document.And also it makes sense when it comes to scaling as well, you ...


0

If the ID returned by your document store is the way to reference documents throughout the system, then it makes sense for all services to accept that 'Document ID' on their API when the service needs to know which document it needs to work with. This does not necessarily create a tighter coupling between the services than needed. Services that need to ...


0

Does anyone know how the rainbow unicorns (Netflix, Amazon, Google, etc.) handle large files / data exchange between their services? Unfortunately I do not know how they deal with such problems. The problem is this - Does it make sense for all our microservices to be accepting this unique ID as part of their API for the purposes of interacting with ...


0

Yes you should always test the system with all real-world architecture if you can, some problem may be only occurred in real system/data tests (out of memory/locked connection/environment stableness). If the business logic and data communication is proven to be working great, the next thing you should focus on will be stress test for the service: Regards to ...


0

Right now I am using Spring in order to handle the REST calls. It works with Java-Annotations and can also convert the objects you are returning to JSON on the fly. I think it is pretty convenient to use so far and it works well in combination with Hibernate (ORM). For example: @RestController public class GreetingController { private static final ...


3

The problem is the URL is not RESTful in the GitHub example: I would rather see actual URL that represent the resource exclusively. It is not that hard if you put a little thought into it. To be truly RESTful the URI should be a resource identifier and nothing else Parameters make it RPC over HTTP which is the opposite of the REST paradigm. ...



Top 50 recent answers are included