Questions tagged [api-design]

API design is the process of determining and exposing a set of consistent method signatures, return values, and documentation intended for use by other developers to allow programmatic access to data.

An API (Application Programming Interface) is what developers use to work with a specific software or platform. API design refers to those practices that lead to developing a good API. A good API design helps developers leverage the full power of your platform while being easy to use. A bad API design can hinder developers from utilizing the full power of your platform and in the worst case can drive developers away from your platform because of its difficulty.

API design shares many concepts with normal programming best practices. A few of these are separation of concerns and prevention of abstraction leakage.

References

2220 questions
0
votes
1 answer

Can REST API PATCH responses with different resource that should be applied to confirm the patch?

I'm working on a server developing REST API. The structure by now (at least what is needed to know for this question) is that I have a products collection retrievable via GET /products, GET /products/:id. I want to be able to edit these products,…
0
votes
1 answer

I'm trying to send a JSON object from client to server and receive a response but all the approaches I find are either inadequate or overkill

I'm in a situation where I'm not sure what is the correct way of doing this. I'm trying to take a large json file, send it to the server, process and reorder it, and then send it back to the client. I don't want to store any data in a database. I…
0
votes
3 answers

REST API Design - Passing multiple rows in Request - Save button

Front End: The front end will have a table. Data will be populated in few columns of the table already. The user will enter the remaining columns of data. The table will have multiple rows. There will be two buttons. SAVE and SUBMIT. SAVE button is…
Roopashree
  • 140
  • 8
0
votes
1 answer

REST: Get multiple resources - what is correct REST approach

I know this question has been answered several times, but I am still not sure that providing GET with long list of non-structured query parameters or POST to get data is right approach. I have provided the endpoint: GET​…
0
votes
1 answer

How to view resource permissions with SelfSubjectRulesReview using curl

In Kubernetes you can use the auth can-i command to check if you have permissions to some resource. For example, I can use this command like that on the worker: kubectl --kubeconfig /etc/kubernetes/kubelet.conf auth can-i get pods -v 9 It will…
E235
  • 11,560
  • 24
  • 91
  • 141
0
votes
2 answers

Which HTTP status code should be returned for failed update because identifier not found?

Suppose I have the following resource collection /api/people With each resource identified by their IDs /api/people/1 /api/people/2 ...and so on... Updating is done by sending POST request carrying payload the data to be updated POST…
bluearth
  • 501
  • 4
  • 18
0
votes
3 answers

Getting JSON values from a .json

I am currently writing a program that pulls weather info from openweathermaps api. It returns a JSON string such as this: {"coord":{"lon":-95.94,"lat":41.26},"weather":[{"id":500,"main":"Rain","description":"light…
Matt
  • 190
  • 1
  • 13
0
votes
1 answer

Trying to set an icon extracted from a file to a TreeView Node.Image using API functions

I'm creating a userform for users in my department that will allow them to select files/subfolders from templates to create a working folder. This is done using VBA7 through Excel 2010 (the only tool available for this department...) on a Windows 10…
0
votes
1 answer

How to protect a public accessible API?

I'm working in creating a FORM (kind of survey) to get user input, any user who visited the website can provide me information. This would means, the API is actually public accessible to anyone without any token or session (basically nothing) I want…
Tommy Leong
  • 2,509
  • 6
  • 30
  • 54
0
votes
1 answer

Design for API with Different requestBody based on variable value

I have a REST API uploadFeed that uploads the user feed based on feedType (string value taken input as part of the request body) . Different feedtype provides a different pojo model in the request body altogether. For e.g If the feedType is lets…
0
votes
1 answer

HTTP Status Codes - 404/NotFound vs 204/NoContent vs 200/Ok

I have Widget entities that belong to Company entities. There is a one-to-many relationship between Companies and Widgets. Here's my first pass at the Get…
Joe
  • 1,091
  • 1
  • 11
  • 23
0
votes
2 answers

HTTP Status Codes - 401/NotAuthorized vs 404/NotFound vs 400/BadRequest

I have Widget entities that belong to Company entities. There is a one-to-many relationship between Companies and Widgets. Here's my first pass at the Get…
Joe
  • 1,091
  • 1
  • 11
  • 23
0
votes
1 answer

Should a REST create request reject bodies with auto-generated fields or ignore those fields?

Given an entity has an auto-generated field, e.g. createdDate: in a POST request, would it be better practice to reject any requests where the body contains a createdDate value since the user shouldn't be trying to set this, or should I just ignore…
DaveJohnston
  • 10,031
  • 10
  • 54
  • 83
0
votes
0 answers

Limit API for use on specific websites

So we have an open API for ZIP codes and would like it so only specified websites can use it. Currently we are using CORS in combination with keys to stop unauthorized websites from using it but there are some cases where that won't do anything.…
K1ll3rM
  • 11
0
votes
1 answer

NodeJS: Get JSON from SQL query

I am new to SQL. I have a database with two tables: users and collections. The table 'users' stores the users of an app while 'collections' stores a collection of items. Each collection is owned by one user. I need to get a JSON object with the…
matt.c
  • 3
  • 1
1 2 3
99
100