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

Type checking on React Native plugin

We have a React Native plugin that bridges a native library both on iOS and Android. This week a client reported he was having issues using it, the method is as follows (Android) @ReactMethod public void setUser(String id){ …
João Miranda
  • 487
  • 1
  • 5
  • 12
0
votes
1 answer

How to organize an API that needs to return all titles from a given entity?

I have the following endpoint that returns a page of one entity /entity?page={page} However, I need another endpoint that returns a list containing the title of all entities. I need that because there is a dropdown filter option that a user can…
0
votes
1 answer

Python teamspeak3 api

I'm creating a bot for TS3 with API from github. In main.py I create connection instance named ts3conn using TS3Connection class. Then I register an event like this: `ts3conn.register_for_channel_events(channel_id, event_handler) In module.py I…
jancor
  • 49
  • 1
  • 1
  • 6
0
votes
1 answer

REACT.js variables not accepted in api request

I'm trying to make my code more efficient and reusable by adding variables on my requests and console.log. But for some reason its not working and I can't figure out why! full code can be found at: https://codesandbox.io/s/wispy-lake-6h051 This…
Owen
  • 178
  • 2
  • 7
0
votes
1 answer

In REST, how to respond to POST of a sub-entity of which there can only be one, and one already exists?

I have a vehicles resource as the root entity of an aggregate. Each vehicle can have zero or one engines as a sub-resource/entity. If vehicle #947 exists, but doesn't have an engine, I can say: POST /vehicles/947/engines /* create an engine…
Jonathan M
  • 17,145
  • 9
  • 58
  • 91
0
votes
0 answers

REST API response handling when 1 of many endpoint fails

I have a Java Application(REST API, Jersey) that orchestrates a lot of backend calls for the front end. It aggregates data from all the backend systems and then returns a JSON response. Now I have to integrate one more backend system, so I added the…
Faiz A.
  • 21
  • 1
  • 2
0
votes
1 answer

Convert Lat/Lon to County Codes using FCC API

I previously figured out how to convert lattitude/longitude to county FIPS codes using the FCC API (Apply an API Function over 2 columns of Dataframe, Output a Third Column) thanks to @caldwellst and @rohit. Unfortunately, the FCC modified the API…
0
votes
0 answers

How to access api.hypixel.net using Python

I am relatively well versed in basic python programming, but I have never learned how to access an API. I just would like to learn how to first access api.hypixel.net and then learn how I would go about accessing anything in this API. I have tried…
0
votes
1 answer

What will be an apt resource name for REST API endpoints that just extracts data out of some documents?

I'm brainstorming designing a REST API endpoint for a POST request, which extracts data out of some documents which i provide in the payload and stores it in database or some temporary location . Also i need GET and DELETE endpoints for retrieving…
0
votes
1 answer

Ways to keep a Typescript library API declaration coherent with its implementation?

Project structure description In my library named mylib I have an API declarartion file src/mylib.d.ts written by hand. There is a reason for write it manually: I want to design an API first and then to implement it (while the tsc with…
khokm
  • 63
  • 5
0
votes
2 answers

What is the best REST API design that enables a resource to be sent by email?

I'm designing a REST API for an ordering system using the CRUD paradigm. My routes are as follows: - GET orders - POST orders - GET orders/{order} - PATCH orders/{order} - DELETE orders/{order} This makes perfect sense to me, however,…
Sconz2
  • 63
  • 2
  • 10
0
votes
0 answers

App with React frontend, NodeJS backend fails to connect with proxy server with API endpoint once deployed to heroku

I recently finished a web app for a fake restaurant using React and NodeJS. Now that I've deployed it with Heroku, there's an error seemingly on the server side. When I try to import menu data from an API endpoint I created (which works fine…
0
votes
1 answer

Fetching Details From API and setting state according to conditions - Functional Components

I have a functional component named Calendar wherein each month is a Button. The API I have designed sends the data in the following format: [ { "month": 1, "count": 5 }, { "month": 3, "count": 2 }, …
user13692230
0
votes
1 answer

REST API - "GET /user" changes user in database

We have a simple User API including "GET /user" to request user information. When processing the request we store the current datetime as "lastVisit" in our database. As a result we have a GET request updating the user in our database, which seems…
0
votes
1 answer

Does the model, the view or the serializer represent a REST resource in Django Rest Framework?

I am building an API using Django Rest Framework, and I'm trying to make it as RESTful as possible. Following this question (and also this question on SoftwareEngineering), I have described a number of resources that my API endpoints will expose,…
Jaap Joris Vens
  • 3,382
  • 2
  • 26
  • 42