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

Return 403 or 201 if a field is not writable

What is the best practice for a response if the user tries to write to a field he or she is not allowed? Imagine the user wants to create a resource, for example a pizza: POST /pizza The body: { "name": "Hawaii", "base": "tomato sauce", …
0x4b50
  • 629
  • 6
  • 18
0
votes
0 answers

How do I create a data access layer that talks to git on a git server?

Problem I want to create a personal micro-Github on a server, but how does one talk to git on the server in an elegant manner? Would it be wise to the send commands to the git-shell using PHP's exec? Would I be talking to git directly? To understand…
eurekasfray
  • 27
  • 1
  • 5
0
votes
1 answer

RESTful API design - CRUD op. & optional action, both in one request?

So I'm creating a RESTful API that manages a list of order in a DB. There is an option to create an order, then users can update/edit the order and eventually call a POST /orders/{id}/send endpoint to send the order. Now, we found out that often…
thisIsTheFoxe
  • 1,584
  • 1
  • 9
  • 30
0
votes
0 answers

Java API design: capturing lambdas versus additional parameters

In C#, a common optimization for methods that use delegates is to provide an overloaded method with an additional argument that lets you eliminate free variables from the lambda. For…
David Kleszyk
  • 642
  • 3
  • 10
0
votes
1 answer

Which http status code should be returned when the identifier in the payload does not exist?

I've the endpoint POST /permission-period which should create a permission period for a specific user. The payload: { "userId": 10, "permissionPeriodDateFrom": "2017-12-01", "permissionPeriodDateTo": "2017-12-10" } If any property from…
ProV
  • 251
  • 1
  • 4
  • 14
0
votes
1 answer

Having same route require and not authentication?

I have doubt regarding my RESTful or general API solution. So, the case is that I need to serve same resource but in public and private manner. Meaning, that GET api/products?private=true will return products owned by current user and require…
djoloho
  • 39
  • 5
0
votes
1 answer

Best practice for REST API URL for authentication

I am a beginner in REST API development, I read some docs online and now I'm developing a REST API for 2 platforms with different kinds of users. Which is the most efficient way to choose URL for authentication endpoints in REST API development? One…
Antonello Gatto
  • 1,603
  • 2
  • 16
  • 29
0
votes
1 answer

How to design a REST API for resources that depend on each other?

I'm having troubles with designing a rest api for the following scenarios: When a new user registers he/she also creates a new group. New users can also join an existing group using a unique group code. Existing users can create new…
pawel.podsiadly
  • 171
  • 2
  • 13
0
votes
2 answers

Proper API for access data members of container

I have the following class: class Document { public: Document(): // default values for members, // ... m_dirty{false}{} // Accessor functions template
user877329
  • 6,717
  • 8
  • 46
  • 88
0
votes
1 answer

How should body of POST request be structured for sub resource creation?

I am creating a post rest endpoint that will create resource 'child'. My uri is: /parents/{parentId}/child What are the rest standards for the content of the body for this request? Should the data be related only to the child resource (option 1) or…
bdeane
  • 52
  • 9
0
votes
1 answer

How to create a task with as trigger a successful task in Qlik Sense

hi i'm trying to create a task with a trigger that start on successful task, the task and the trigger seem to be correct but when the father task end doesn't start the trigger of the new one, i follow the script that i found in the documentation at…
user273686
  • 81
  • 1
  • 8
0
votes
1 answer

How to create ASP.NET Core Web API properly

I little unsure of my actions. I started my first web api application. So I wanna create api where is all functionality include authorization. And web and mobile applications which will work with my api. Something like that But I discover problem on…
nefosfatus
  • 77
  • 5
0
votes
1 answer

Separate API endpoints for when attributes vary slightly

Suppose I have a sports player endpoint. It gives me their dataOfBirth, salary, firstName and lastName. Great covers all sports. Rugby, Soccer, you name it... Then someone wants goals scored for the soccer endpoint and someone else wants number of…
More Than Five
  • 9,959
  • 21
  • 77
  • 127
0
votes
1 answer

Naming the RESTful API route. Naming of an action on a resource. What is the approach?

I have the following route with cars as a collection resource. /api/v4/cars /api/v4/cars/{carId} Now I want to introduce a "Price per car", but this price is dependent on the input, not fixed. So when the user calls the pricing endpoint, it should…
Sero Daniel
  • 115
  • 7
0
votes
1 answer

creating an api to update postgres db with a json or yaml payload

I decided to ask this here after googling for hours. I want to create my own API endpoint on my own server. Essentially I want to be able to just send a yaml payload to my server, when received I want to kick off my python scripts to parse the data…
Rdell
  • 3
  • 2