An application programming interface (API) is the specification for which software is meant to be used by other software.

learn more… | top users | synonyms

4
votes
4answers
175 views

How to prevent user from requesting API method multiple times in parallel?

Let's say we have an app where the users gain points and can exchange them for rewards. The exchange request, in pseudo-code, could look like this: function exchangePointsForReward(userId, rewardId){ ...
2
votes
2answers
304 views

How to correctly implement key=value storage REST API

I'm new to REST API, so I decided to get familiar with it by designing a small web service API. I have its design written down and would like you to review it. I feel like I have made some mistakes in ...
2
votes
1answer
113 views

Tracking online users with a stateless architecture

I own a stateless architecture, exchanging a JWT token between client and server at authentication time. I want to store in database (once per day) a timestamp related to the user access. Indeed, I ...
0
votes
2answers
153 views

JSON API specification : When do I need to return a 404 not found?

I'm working on a REST api following the JSON api specification and I'm struggling with the "no data" responses (described here). A server MUST respond with 404 Not Found when processing a request ...
4
votes
1answer
212 views

Many asynchronous calls vs single call to the API

We are developing a REST API which among others is going to be consumed by an HTML5 frontend via javascript. The application is for use within the organization and usually has about 300 users, but we ...
3
votes
2answers
93 views

Change database based on request origin

I am developing a web application which will be run by multiple companies. Each company will have its own instance of that web application and its own database. The web applications and databases ...
0
votes
2answers
140 views

What is it exactly that makes programs platform dependent when they're using cross-platform APIs?

I understand that programming languages can either be run in a VM (Java, etc) on every OS that supports the VM natively or can be compiled to machine code (C, etc) for each platform. What I don't ...
3
votes
1answer
304 views

why use authentication token instead of session_id for app(android side) in REST API

in normal php web application after login we use session_id that came from web browser to check if user loged in or not. But in REST API authentication I read some tutorials that say php should send ...
6
votes
1answer
386 views

Unit testing an API client and wrappers

I've been going round in circles trying to figure out the best way to unit test an API client library I'm developing. The library has a Client class which basically has a 1:1 mapping with the API, and ...
6
votes
2answers
226 views

Advice for designing API request rate limiter?

I'm in the planning stages of a web application that makes heavy use of data retrieved from a third party's REST API. This data is cached on the server and requested by clients via AJAX. The REST API ...
3
votes
0answers
77 views

Sharing identical events, with differing scopes, between client and server libraries, in a micro-service architecture

I have a shared user repository (id, name, e-mail, password, etc.) exposed as a REST service - and multiple independent web-sites accessing this REST service (from the back-end) as a means of sharing ...
6
votes
1answer
227 views

How do you organize API endpoint contracts

Where trying to improve the "confidence" we have in our inter-service communication. Background: "Contracts" has been a matter of sharing a piece of code that defines an interface to implement, but ...
0
votes
0answers
96 views

Using the Facebook Login button, how would I securely convey to my web app's backend that the user is authenticated?

Background: I'm building a web app using the most recent Facebook Javascript SDK to help with user registration and login. The backend is built in PHP, but that likely is irrelevant. The situation: I ...
36
votes
5answers
2k views

How is defining that a method can be overridden a stronger commitment than defining that a method can be called?

From : http://www.artima.com/lejava/articles/designprinciples4.html Erich Gamma: I still think it's true even after ten years. Inheritance is a cool way to change behavior. But we know that it's ...
3
votes
1answer
249 views

Best practice for Restful API that perform heavy calculations (Image Processing)

We are currently developing an image processing restful api. Server performs some CPU-heavy computations image processing upon request and return the image to the client. We want to make this a ...
3
votes
1answer
128 views

Can this be considered an API? [closed]

I'm writing my first API, but I think I screwed it up from the design. It's a simple CRUD API which behave like this: READ: /api/data gets redirected to api.php?data1=data. POST variables: user, ...
0
votes
0answers
32 views

Where should user input be validated? [duplicate]

I am working on a webbased user interface using AngularJS. As a database I am using MongoDB which can be accessed through an Python-eve-API. The API is able to validate the passed data as stated in ...
0
votes
1answer
81 views

Internal API to public API - versioning

We have an internal API that is specifically for our website and internal applications, and we are planning to release a public api exposing some of the endpoints in our internal API. We are using ...
1
vote
3answers
258 views

Soap vs. rest - a hybrid approach? [closed]

I have a proper SOA architecture, with web services defined with WSDL and responding to SOAP requests. But this application has also an endpoint that responds to json request and replies in json ...
1
vote
1answer
73 views

When and how long should I cache data read from an external API?

I am working with an API but I am unsure what the best way to store the API return values. Specifically, I am working with the RIOT API just as a small hobby project. I would like to store this ...
3
votes
2answers
220 views

Should I use my own public API for my web interface?

I am designing an API with django and its rest framework (and I am already not sure if it worth the hassle to version it or not). I totally know the iOS and Android apps will call the API, get a ...
3
votes
1answer
89 views

Image resolution in a RESTful interface

Background I have a RESTful HTTP API. I have a resource. GET /my/cat HTTP/1.1 Clients may want to retrieve the image representation of this resource. GET /my/cat HTTP/1.1 Accepts: image/png ...
0
votes
1answer
52 views

Can I use data from the Amazon API in my App?

I'm having a hard time finding information on this, but using the Amazon API (such as the ItemSearch api) provides you with data on Amazon products. In my case I am interested in books. The Amazon ...
0
votes
1answer
76 views

Should API DTOs be shaped to client(s) or be universal?

I have a project with an internal desktop client app and a server-side client API service talking to a relational database. I seem to have two choices: 1) shape DTOs to client views, e.g. ...
6
votes
4answers
848 views

Should a REST API be able to convert datetime to appropriate clients timezone?

Whilst implementing our API, the issue of datetime and timezones came up. All dates are normalized to UTC in the database. Currently, in the non-API application, all datetimes are converted based on ...
2
votes
2answers
159 views

Rest api with a hello resource / main entry point

I'm designing a Rest API for our web application. There's one idea that came to my mind today and I haven't found in recent searches: a "hello" resource, where clients are supposed to connect as the ...
0
votes
0answers
38 views

Best way to update driver data from userspace

I have a userspace application which interacts with a kernel-space driver in a Linux environment. The driver, in this case, is an LED driver. In typical *nix fashion, the driver exposes a file in ...
2
votes
3answers
406 views

Are colons ok in a REST API?

I see many REST API examples with URIs like http://<whatever>/widgets or http://<whatever>/widget/123, for a specific thing. For most things I would just stick with the front slash, but ...
1
vote
0answers
27 views

Most suitable solution for logging traffic to external services - ASP.NET

My application relies on several external services - labelled Service A, Service B and Service C in the diagram. I am looking at ways of logging the number of requests made to these services, and the ...
1
vote
0answers
56 views

Is it OK to use mongodb's query object format as a parameter for my api?

I am designing an api that can give developers read-only access to a large dataset. The data is stored in a mongodb database. All the results of the api, will basically either be a count of matches ...
0
votes
1answer
126 views

Function or class design in library API for efficient object reuse

I am currently building a library in C++11, where I spent a lot of time trying to design a good interface. After some small redesigns along the way, I've ended up with a design that I am happy with. ...
1
vote
1answer
210 views

Databaseless ASP.NET MVC 5 on top of an external REST API

Where you would envision an out-of the-box ASP.NET MVC 5 web application on top of an MSSQL database, I have now been placed in a situation where I'm supposed to use custom external token endpoints ...
2
votes
1answer
68 views

How do you stick to an ABI/API in a commercial library?

How does a commercial library vendor manage to stick to the same ABI over years of development (or is this a bad assumption on my part)? I would have thought that over time a lot of functions and ...
1
vote
1answer
100 views

Is it correct to implement all the payment flow in the client rather than in the server?

I’m building a mobile app marketplace and I came to the point of integrating a payment tool. I'm using Mangopay, which has a nice workflow for making payments in a marketplace using its REST api. The ...
1
vote
0answers
68 views

Alternatives to setting up an API system

I want to launch a service that could support integration by third-parties. Unfortunately it’s way out of hand to build an entire API by now. Here’s my question: Would there be any possible solution ...
2
votes
1answer
175 views

Writing a programming api for an existing project? [closed]

I've an already existing project in C#. Now I should implement a plugin system. For this plugin system I've to implement a programming api/sdk. I dont want, that plugins have access to the assemblies ...
3
votes
3answers
1k views

Microservices REST or AMQP, which case

I've read many articles concerning microservices architecture and I was wondering when to use AMQP or REST. I've read that losing couple between services is a good thing and AMQP seems to be a good ...
0
votes
0answers
67 views

Understanding SSO flows

I m actually studying SSO using OAuth2 and I m having some questions working with real architecture. I understand the way how we connect to a tier server, getting an access token and making requests ...
0
votes
1answer
162 views

API Breaking Changes

I have a public REST API for creating new business profile records in my system. The request itself looks similar to this: { "BusinessName" : "AName", "CurrencyCode" : "USD" } You can see ...
1
vote
0answers
73 views

Word for method that gets and sets? [closed]

Is there a word for the API pattern where a method may get or set, depending on whether it is called with an argument or none? This style is often used in JavaScript: obj.prop(); // ...
1
vote
1answer
81 views

REST API and user rights

I am developing an application using Angular and REST API and I'm facing a problem concerning user access right. The application runs this way: A user signup The same user creates his organization ...
19
votes
3answers
6k views

REST API security Stored token vs JWT vs OAuth

I am still trying to find the best security solution for protecting REST API, because the amount of mobile applications and API is increasing every day. I have tried different ways of ...
1
vote
1answer
189 views

Best way to separate public API from internal implementation [closed]

I'm developing a little framework (in Scala) where I want to define clean and simple interface for the users of the framework. Some of theses interfaces have to be implemented by the framework itself, ...
2
votes
0answers
507 views

Assembler vs Entity Translator and Entities vs DTO

I was hoping that someone could explain the exact difference between an Assembler and Entity Translator. Martin Fowler describes the Assembler as a sort of Mapper(?) which converts DTOs into Domain ...
1
vote
1answer
216 views

Methods of preventing SPAM with an API - AngularJS Website Contact Form

I'm exploring AngularJS and ran into an interesting question. If I develop an API to power my AngularJS website it would include public facing items such as a Contact Form. Assume an API method exists ...
8
votes
5answers
355 views

How to prevent changes to an internal API from breaking other projects?

We have like 20 - 30 independent modules/solutions. Each of these has about 7 - 10 projects with different classes, components, etc. These are all used internal to our company. Our problem is when ...
0
votes
2answers
606 views

Too many REST API calls on a page?

A web app designed with highly modular, small components (in this case using AngularJS directives but could just as easily be WebComponents, ReactJS components, or any other technology). Components ...
9
votes
3answers
395 views

CRUD API: How do you specify which fields to update?

Let's say you have some kind of data structure, which is persisted in some kind of database. For simplicity, let's call this data structure Person. You are now tasked to design a CRUD API, which ...
2
votes
3answers
99 views

How to consume standard routed API in a clean way?

Let's take an example of a generic API endpoint that looks as follows: https://api.imgur.com/3/gallery/{section}/{sort}/{window}/{showViral}/{page} Conditions on this endpoint are as follows: ...
0
votes
1answer
71 views

End to end testing of write-only apis

In our deployment process for our services, besides unit and integration tests, we also have a little smoke test for our services. Mostly for verifying that the deployment went well, cloud services ...