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
2 answers

Specify a number of items or all items in REST API request

I am designing an API and am wondering the best practice for values that can either specify a number or a list of items, or just specify that it is 'all' of those items. For example imagine an endpoint /analyze that allows you to analyaze a document…
iain
  • 39
  • 1
  • 9
0
votes
2 answers

Razor and Creating Helpers for Users: Html.*

I have an ASP.NET MVC3 (with Razor) application where I allow users to specify components for the view -- like the layout, or partials that I use to render content. (For example, I have a model that has a Title and Description, and I allow users to…
ashes999
  • 9,925
  • 16
  • 73
  • 124
0
votes
2 answers

REST API design to GET summary and details

I have 2 UI screens. the first UI screen only displays high level summary such as class, number of students in class. i have details screen that displays the more information such as class, number of students, students information in class etc.…
user476566
  • 1,319
  • 3
  • 26
  • 42
0
votes
1 answer

Generic vs Specific API Responses

Any thoughts on how specific API response messages should be? I'm looking at this from a Security perspective related to validating on data types. Say my API requires string for an id and that my server validates the type - if not a string, should I…
user2402616
  • 1,434
  • 4
  • 22
  • 38
0
votes
1 answer

GET endpoint: Parsing parameters vs Adding a new endpoint

I have users and posts. Users can make posts. I am creating an endpoint for the posts. Does this make sense? Posts /posts - POST, create post /posts?{uID} - GET, get posts for user /posts?{pID} - GET, get post by id /posts/{pID} - PUT, update post…
GRS
  • 2,807
  • 4
  • 34
  • 72
0
votes
3 answers

Rest API Hateoas : Should API response have identifiers as hard coded or as placeholders?

Link to the HATEOAS This is the link to the Hateoas article (snapshot below) where the identifiers of the resource is part of the URL i.e. 12345. Here the API response has the final API relative URL i.e. /accounts/12345/deposit and the client just…
Sahil Sharma
  • 3,847
  • 6
  • 48
  • 98
0
votes
1 answer

GraphQL stitch and union

I have a need to 'aggregate' multiple graphQl services (with same schema) into single read-only (query only) service exposing data from all services. For example: ---- domain 1 ---- "posts": [ { "title": "Domain 1 - First post", …
zbubric
  • 363
  • 3
  • 10
0
votes
1 answer

Capture handle by reference or by value to class template ctor

Consider a tempalted class InputBuffer: template class InputBuffer { public: explicit InputBuffer(Source src); int getchar(); private: std::byte const* m_read_ptr; std::byte…
user877329
  • 6,717
  • 8
  • 46
  • 88
0
votes
2 answers

Which RequestBody type should be used if using the same payload to make another request?

Background We are consuming the API from a 3rd-party vendor Problem Statement: I am building a wrapper API around another API. The same exact JSON payload that I will be receiving from the client to the wrapper API will also be used to make an HTTP…
ShadyBears
  • 3,955
  • 13
  • 44
  • 66
0
votes
1 answer

how can I get an element in a redirect url using node.js

Non-English country, please forgive my spelling mistakes. For example, I want to first redirect url1(http://localhost:3000/api/song/167278) to url2(http://localhost:4000/api/song/167278) to use url2's api. And url2 will reponse a json file, which…
gricn
  • 63
  • 12
0
votes
1 answer

How to authenticate that a request came from a website?

I and a friend are building an API with a web front end. The web utilizes the API via Ajax requests to interact with the back-end. We would like to offer limited access to the API for people not using the website (you must pay a fee to use the API),…
0
votes
1 answer

Efficient way to map numbers 1 to 1 in a pseudorandom manner?

I don't want to return raw user IDs to the frontend. A lot of people solve this by generating random IDs and checking if they're already in the DB. I want to find a way to map numbers in a known range 1 to 1. This way, I can still use…
Leo Jiang
  • 24,497
  • 49
  • 154
  • 284
0
votes
1 answer

Embedded javascript, sending form data back to the application. Routing error

Context Within an rails app, I created an embedded javascript form using Vue, external websites of shops cope/paste to let their website visitors search for available bike_categories. Goal Now I created the form they can copy/past and I would like…
techquestion
  • 489
  • 5
  • 20
0
votes
1 answer

NodeJS API with Kafka back-end

I want to build a NodeJS based API that is backed with a pub-sub paradigm with e.g. Kafka. Here is a skeleton of what I want to do. const express = require('express') const serverApp = express() serverApp.get('/book/:bookId', (req, res) => { …
cogitoergosum
  • 2,309
  • 4
  • 38
  • 62
0
votes
0 answers

List every way to log and access the query,latency and returned data size information from MySQL server?

So I'm thinking of writing some metrics infrastructure for MySQL and in this particular case I need to get the query along with latency and size returned data. I don't care about insert or functions just queries. Is the post-parse plugin path the…
West
  • 722
  • 7
  • 16
1 2 3
99
100