Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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.

0
votes
1answer
11 views

How to slow down asynchrounous API calls to match API limits?

I have a list of ~300K URLs for an API i need to get data from. The API limit is 100 calls per second. I have made a class for the asynchronous but this is working to fast and I am hitting an ...
0
votes
0answers
41 views

Dynamic Workflow Architecture in Microservices

Consider the following situation: You have a system that consists of some number of microservices - say, A,B,C,D and E. The users of your system provide you an input(say a file format) and need the ...
0
votes
0answers
7 views

Making Wordpress user metadata available to Rest-API

I am building an Ionic app that ties into my Wordpress website Rest API. While I have figured out how to populate post and page data, I am having a very difficult time populating user data. ...
0
votes
1answer
13 views

How to stagger asynchronous API calls to prevent Max retries with grequests library?

I have a list of ~250K urls for an API that I need to retrieve. I have made a class using grequests that works exactly how I want it to except, I think it is working too fast because after running ...
0
votes
0answers
17 views

How to send batches of URLs into grequest?

I have a list of ~300K API URLs that I want to call and get data from: lst = ['url.com','url2.com'] If I subset my list down to say 5 urls grequest handles the request perfectly. However when I pass ...
1
vote
1answer
23 views

Why would AWS API Gateway let cached queries through to the backend?

I have a GET method in AWS Api Gateway. The cache is enabled for the stage, and works for most requests. However some requests seem to slip through to the backend no matter what I do. That is, some ...
1
vote
2answers
38 views

Laravel API Architecture - best practices

I'm implementing an API that can create clients and create contacts. Contacts may be associated with a client. I have my ClientController.php with all the CRUD methods. I also have a ...
1
vote
1answer
117 views

Correct way to return incomplete result in REST API?

I have a REST API that aggregates data from several different sources, does some formatting, and provides it back in a JSON payload. /api/blah/resources [ { "name": "resource1", "...
0
votes
0answers
15 views

Emulating API for consumers

We develop and manage a set of web services that in turn communicate with many third part systems. For our integration testing and UAT environments we have always built simple emulators (think ...
0
votes
0answers
17 views

How does one create a single API where the endpoints can be both private and public?

I am building a platform that will have an API and I would like to have my own client-app be able to access the entire API without having to do any API-Key handshakes. This is easily done with a same-...
3
votes
2answers
250 views

Implementing “JSON Merge Patch” in ASP.NET Core - best way do differentiate between null and not defined property

I would like to create and endpoint conforming to "JSON Merge Patch" https://tools.ietf.org/html/rfc7396 Please do not confuse it with "JavaScript Object Notation (JSON) Patch" https://tools.ietf.org/...
0
votes
0answers
30 views

Get latest posts from tumblr API then load into JS when not a local image

I have a working JS that follows the mouse icon and draws images in it's place. It successfully works when the images are local files as the code below shows but I've been experimenting with loading ...
-4
votes
1answer
336 views

REST API versioning in Laravel

I wanted to make versioning like a domain. So inside app directory i want to move all folders into v1, v2, etc. So it will be App\v1, App\v2 namespaces. I need an advice, how to re-write bootstrap/app....
0
votes
1answer
19 views

Which status use when iterate into the same request?

I have a concern about which status code need to use in the following scenario: Suppose that I have the following endpoint: https://my-restaurant.api.com/v1/orders And I made a POST request with ...
0
votes
0answers
9 views

API design and backward compatibility using protobuf

I am designing a web API that is a wrapper around some calculation code which is provided as a Java library, lets call this the library. The idea is that the API should be backwards compatible: the ...
3
votes
1answer
28 views

How to iterate over list of lists while passing each value in the lists into API and pausing after each list of list?

I have a list that looks like this: lst = [1,2,3, etc] I can successfully iterate over this list and pass the IDs into an API. However the API breaks after certain point in regards to number of Ids ...
-1
votes
2answers
52 views

What is the purpose of having hashCode in Optional [duplicate]

Can someone please explain the purpose why do java people override the hascode in Optional
0
votes
1answer
21 views

GRPC design of a current REST API

i'm looking at the posibility of porting a lot of our REST API services to a GRPC schema, but here is the thing. We currently make heavy use of one method of the API, that makes calls to multiple ...
0
votes
0answers
12 views

API Authentication - Clients (consumers) vs. local users

I work for an ecommerce site and we are looking to expose much of our core functionality via a set of APIs. We plan on re-writing some of our own public facing applications (e.g. the main shop website ...
0
votes
1answer
16 views

How to pass row of dataframe into API if System.ArgumentException being raised?

I Have df that looks like this: id 1 2 3 I need to iterate through the dataframe (only 1 column in the frame df)and pass each ID into an API, where it says &leadId= after the equal sign. I.e &...
4
votes
0answers
46 views

Why do we need EPOLLRDHUP when EPOLLHUP seems enough?

According to the linux man page, EPOLLHUP When reading from a channel such as a pipe or a stream socket, this event merely indicates that the peer closed its end of the channel. ...
0
votes
0answers
23 views

Can't run loopback app with DataPower through API Designer

I'm new at IBM Api Connect, and Loopback. I followed this tut: https://community.ibm.com/community/user/imwuc/browse/blogs/blogviewer?BlogKey=3e2a288d-96c1-4b04-aceb-e8cd5cbcbee1 I installed nodejs ...
0
votes
0answers
20 views

How do I plug the API access token in a GET request for a response?

I'm trying to access the DOL API (US Department of Labor) to get inspection records for Heath and Safety. This is the link that has all the request URLs for different information that the DOL has ...
0
votes
2answers
60 views

Why std::thread lacks basic features? [closed]

In std::thread: No stack size on thread creation. No thread priorities. Why? What's the use of such API? It's the very base of thread concept. Stack size, why we don't care about memory? Maybe ...
0
votes
0answers
14 views

Mongoose multi query operators with expressjs

I'm trying to learn how to make an API. And I met a problem that transcends me. My problem is about to database queries. This is my endpoint; /api/stats/:userId/:period/:type/:point?/ :userIdis ...
0
votes
1answer
24 views

RESTful API - refresh specific resources operation

I have a set of resources: [{ "name": "process-1", "id": "1", "state": "active" },... ] I get them by GET service-name/version/processes?state=running&sort=by_date I need to update the set: ...
2
votes
2answers
126 views

API design for machine learning models

Using Django rest framework to build an API webservice that contains many of already trained machine learning models. Some models can predict a batch_size of 1 or an image at a time. Others need a ...
0
votes
1answer
34 views

How do I convert an object passed from an api back to that item's class?

In my api I have a class with a few fields including one of type object. I insert an object of another class into that field. Then I return the entire class back to the program calling the api. In ...
0
votes
2answers
40 views

REST API - Logical way to name an endpoint

I want to follow the best practice to implement a REST API. There is a resource I want to expose and I can think of two ways of doing it as an endpoint. I want to give the user the opportunity to ...
0
votes
1answer
30 views

How to handle error datatypes and response messages in RESTful API design

I am building my first RESTful API for practising and learning. I am using RAML and will realize it with MuleSofts AnypointStudio. I don't really know how to deal with responses, particularly, error ...
0
votes
0answers
48 views

Using PHP SESSIONS in an API environment

I have built a cordova mobile application that uses slim framwork to create API's to communciate with my database. The last step before I finish the project is properly setting up SESSIONS so that a ...
1
vote
2answers
40 views

REST endpoint: how to proper design an action on a resource?

I have the resource /contracts with the following structure: { name: "Contract name", signedAt: 123213231, // etc. } While basic CRUD operations are well clear (GET /contracts, GET /...
1
vote
2answers
24 views

Is it better to have 1 lambda per route? or 1 lambda that handles child routes?

If I have an API that has the following routes POST /slack POST /slack/hook POST /slack/another-hook POST /slack/hook/nested is it better to have 4 separate lambdas and 4 routes in the API Gateway? ...
2
votes
2answers
32 views

Dependency Injection on Customer Facing API

I am currently designing an API and I have run into a design issue I'm not sure how to approach. I have a customer facing class that depends on another class from within the model. I need to test the ...
1
vote
0answers
30 views

RESTful API :: Visibility of resource with different user permissions

I am working in a restful api to use in mobile and website but I can not find documentation to understand the right way to use resources with different user permission E.g.: I have the the endpoints ...
0
votes
0answers
48 views

Given this Worker-API, how do I create an infinite loop of Jobs?

Since I wasn't able to find anything about my specific problem, I'm going to ask this for myself here. I've got this API for workers in Go: package workerapi import (...) var MaxWorkers int = 1 &...
-1
votes
0answers
8 views

API design: Should I use pascals (standard unit) or hectopascals (multiple unit but more commonly used)?

My API returns particulate matter, temperature, humidity and pressure. All values are in standard units (i.e. µg/m^3, Celsius degrees, relative humidity in %...). The problem is with pascals. Pascal ...
1
vote
1answer
40 views

API Design: pass id or complete object

Assume, there is a person and an address object. The person does not hold a reference to the address, but only its id. E.g: Person { id: PersonId, addressId: AddressId, name: String, ... } ...
-1
votes
2answers
117 views

REST API naming convention Best Practice for create or update a resource

In my application, a client can create resources for which we compute our ID and assign it to the resource. However a client can also reference, for every resource, a specific ID it wants to use (we ...
179
votes
12answers
110k views

What is the proper REST response code for a valid request but an empty data?

For example you run a GET request for users/9 but there is no user with id #9. Which is the best response code? 200 OK 202 Accepted 204 No Content 400 Bad Request 404 Not Found
0
votes
0answers
23 views

Creating a Web Frontend using a REST API built for mobile application

I have a REST API built with Slim framework. The API contains all the Models of the databases and has various endpoints that are accessed by my mobile apps. Now I want to build two different Web ...
0
votes
1answer
28 views

How to iterate through dataframe based on timer?

I have a dataframe that looks like this: id text number url 1 test1 123 a.com 2 test2 456 b.com Once per day I want to iterate through only one row of a dataframe into an ...
0
votes
0answers
15 views

How to make csv into webservice?

I have a csv like this: id age email 1 20 a@a.com 2 20 b@b.com 3 21 c@c.com Is there anyway I can put it on a server or something similar, that would allow me to call the csv via ...
0
votes
0answers
18 views

How to properly write a Rails API controller to perform a full sync to an iOS client

I'm currently developing an API that will be providing data to a web app and an iOS app. The iOS application will support offline use so it will require a "sync" to grab everything that the API ...
-1
votes
2answers
64 views

REST API Designs with categories

Let's say there is a SINGLE mobile application which receives various types of notifications (like WhatsApp notifications, Facebook Messenger notifications ,etc). What would be a better REST API ...
0
votes
0answers
20 views

C# Impersonate CredentialCache.DefaultCredentials

I'm currently developing an API whose purpose is to download documents in different environments. One of these environments is Docuware, and to connect to it I use the following code : ...
0
votes
0answers
23 views

Benefit of JWTs over plain message + HMAC?

I'm a software developer, not a cryptographer. I'm looking for a way by which customer programmers can send us authenticated claims via the frontend (we ship a browser-targeted JS API). The usual ...
1
vote
1answer
29 views

HttpStatus if resource id in REST route differs from id in payload

Which http status is most appropriate to reject a (PUT) request where the id in the route does not match the id in the resource that is included in the request body? Example: [HttpPut("/api/todos/{...
1
vote
1answer
47 views

What are some methods to document contracts between microservices?

In an HTTP-driven microservices architecture, each service might have a number of public endpoints that return JSON, for example, to a client or an API gateway intermediary. These services could also ...
2
votes
2answers
83 views

REST API to create one or multiple resources?

The options I can think of are: 1 POST /book (object) - creates one book POST /bulk/book (array) - creates multiple books 2 POST /book (object|array) - creates one or multiple books depending on ...