Skip to main content

All Questions

Tagged with
0 votes
1 answer
313 views

Handling a numerical value that may be specific or a range in a REST API

Let's say I have a REST API that needs to return the width of an object, but that width may either be a specific value or a range of values. What would be the best practice for designing the API to ...
jem473's user avatar
  • 11
1 vote
1 answer
179 views

Can a REST API response include a reference and preview data

Let's say I have a REST API with resources that look something like this: /users/<id> { "id": <str:user_id>, "firstName": <str:first_name>, "lastName&...
NotBadJon's user avatar
-1 votes
2 answers
121 views

Best practices for API design for an E-Commerce System

I have a few basic questions on how to implement an API for a basic e-commerce system. The relevant entities are Customer, Puffle, and Review. Each Puffle can have zero or more Reviews. Each Review is ...
Richard Robinson's user avatar
8 votes
6 answers
6k views

How should an API handle unsupported fields?

Let's assume I have this API on /api/v2/persons that enables me to create new entries by POSTing this JSON: { "name": "me" } The API is implemented using Spring Boot and if ...
Marged's user avatar
  • 225
0 votes
3 answers
2k views

How to design RESTful API for response object properties dependent on request parameter

I have a RESTful service where clients provide product codes, start date and end date. In response, the service returns a list of price metrics for the products over the date range. Start date is ...
James's user avatar
  • 285
1 vote
1 answer
788 views

Java REST services - What are best practices regarding DTOs?

I've been working on a project that communicates with a service which sends very complicated REST responses. Current "best practice" on this team is that we use POJO DTOs to handle all data ...
Astrum's user avatar
  • 143
1 vote
1 answer
163 views

Consuming complex JSON service that does not have schema

Hi I have this weird situation where I have a JSON producing service that represents a very complex object graph and this bject graph does not have a JSON schema that it is based on. The reason for ...
Alexander Petrov's user avatar
-2 votes
1 answer
79 views

RestAPI different json for list of items and item details

I have a RestAPI with two endpoints: /items - list of items /items/2 - selected by id, an item details returned json for list of items is { "id": "1", "name": "Max&...
Blazej SLEBODA's user avatar
1 vote
3 answers
5k views

Is it bad practice to in a REST API to use Form Data in POST requests when all responses are in JSON?

When developing a REST API, is it ok to use Form-Data in POST requests or is that frowned upon? All my methods return a JSON body or only an HTTP code, should this be extended to my POST and PUT ...
BaraKanske's user avatar
2 votes
1 answer
3k views

How to parse a dynamically changing Json file? (c#)

So I know a little bit about parsing Json data but not too much so pardon if I am not describing everything as I should. Lets use this Json file as an example: { "firstname": "John", "...
EmperiumIce's user avatar
12 votes
5 answers
32k views

Is it a bad idea to pass JSON objects on the query string for an API "search" operation?

I'm building an API endpoint for a UI grid to search, filter, and display a list of domain objects, let's call them "widgets." In the past, I would have built this with a list of named query string ...
AJ Johnson's user avatar
0 votes
1 answer
263 views

API Request/Response Model for showing differences in JSON objects

I am writing an API to merge two different JSON Objects. Both of these objects can have same as well different number of properties. Object 1 : { "name": "Sam", "lastName": "Hanks", "...
Code-47's user avatar
  • 101
1 vote
1 answer
35 views

Represent nested resources that has two different type (entites) owners in REST APIs?

Suppose I have a entity called Appointment. This entity represents an medical appointment between one Doctor and one Patient. To create a new Appointment, I send somethind like: POST /appointments {...
Matheus's user avatar
  • 173
2 votes
2 answers
407 views

How to create useful error messages in a JSON REST API without leaking implementation details across layers?

We're implementing a REST service with three main layers: Controller, Domain, Repository. The REST API is supposed to respond to error conditions with meaningful error messages. Suppose the general ...
Aleksandar Dimitrov's user avatar
2 votes
2 answers
1k views

backwards compatibility of REST API for update/patch when adding new fields

Context: Suppose the current way to update a person is to use HTTP PATCH, where you can set the firstname and lastname: { "firstname": "john", "lastname": "doe" } And you want to add an extra ...
Langevingers's user avatar

15 30 50 per page
1
2 3 4 5