Questions tagged [api]

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

Filter by
Sorted by
Tagged with
22 votes
9 answers
8k views

Declaring that a function never returns

If I have a function that never returns (it contains an infinite loop) how do I declare/communicate that it will never return to the user of the function? The user does not see the source code, only ...
Fred's user avatar
  • 489
22 votes
10 answers
9k views

Is it a really required skill to program without API documentation? [closed]

I barely passed my Java programming exam today. I had to answer some general questions about threading which I did well and to write a little threaded program which was worse. I had to connect my ...
bancer's user avatar
  • 361
22 votes
5 answers
17k views

Joda Time vs Java Time

Although Joda is feature rich and more sophisticated than standard Java time, it may not always be the best thing to use. How do I decide if I should use Joda Time or Java Time in any Java code? Is ...
Jedi Knight's user avatar
22 votes
4 answers
8k views

What is the need for 'discoverability' in a REST API when the clients are not advanced enough to make use of it anyway?

The various talks I have watched and tutorials I scanned on REST seem to stress something called 'discoverability'. To my limited understanding, the term seems to mean that a client should be able to ...
Aditya M P's user avatar
22 votes
4 answers
11k views

Deprecate a web API: Best Practices?

Eventually you need to depreciate parts of your public web API. However I'm confused on what would be the best way to do it. If you have a large 3rd party app base just yanking old versions of the API ...
TheLQ's user avatar
  • 13.6k
21 votes
4 answers
61k views

MVC and RESTful API service

MVC is pretty straightforward. There is a Model, a Controller and a View. When we create a website, it all come together as 'client sends REST keyword request to server -> the server matches the ...
simon's user avatar
  • 369
21 votes
7 answers
2k views

How do I manage a very large set of rules and magic numbers in my program?

I'm somewhat new to programming (I'm a mechanical engineer by trade), and I'm developing a small program during my downtime that generates a (solidworks) part based on input from various people from ...
user2785724's user avatar
21 votes
5 answers
16k views

Internal and external API architecture

The company I work for maintains a successful SaaS product that grew "organically" over the years. We are planning to expand the line with a suite of new products that will share data with the ...
Drew Goodwin's user avatar
20 votes
8 answers
2k views

"Public APIs are forever: Only one chance to get it right"?

In an OS book I just read that, "Public APIs are forever: Only one chance to get it right". Is it true? Is it applicable only in APIs of Operating Systems or other APIs too? For example, will this be ...
user avatar
20 votes
4 answers
42k views

What does it mean to "expose" something?

So I am working on creating a Google App Engine Application, and I've come across the term "expose" a number of times, e.g. "your first app can expose objects using an HTTP based API" and "expose this ...
EasilyBaffled's user avatar
20 votes
2 answers
2k views

Should one always know what an API is doing just by looking at the code?

Recently I have been developing my own API and with that invested interest in API design I have been keenly interested how I can improve my API design. One aspect that has come up a couple times is (...
markmnl's user avatar
  • 727
20 votes
1 answer
16k 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 ...
mattinsalto's user avatar
20 votes
4 answers
20k 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 loose coupling between services is a good thing and AMQP seems to be a good ...
Thomas thomas's user avatar
20 votes
1 answer
6k views

Why is 'aggregation' not supported in most API Gateway solutions?

When reading about API Gateway, one of things that come up every single time is that API Gateway is a place where you should aggregate results from multiple endpoints. That sounds really nice. However,...
Moon's user avatar
  • 535
19 votes
5 answers
32k views

Is it bad practice to use hyphens in JSON keys?

I see a lot of questions revolving around accessing JSON keys that use hyphens (kebab-case), but now I find myself wondering should I just stick to camelCase or snake_case in my keys. I know hyphens ...
Matt Oaxaca's user avatar
19 votes
1 answer
17k views

RESTful API and i18n: how to design the response?

We are designing a RESTful API that is mainly intended to meet the needs of a single client. Because of its very particular circumstances, this client has to make as few requests as possible. The ...
AMM's user avatar
  • 301
19 votes
3 answers
2k views

Does decoupling trump DRY in REST?

I am building a REST API to expose most of functionality of an existing Java API. Both APIs are for internal use within my organization; I do not have to design for external use. I have influence ...
Will's user avatar
  • 712
19 votes
2 answers
18k views

When to use nested resources in a RESTful API

I have two resources: users and links. Users can have several links associated with them. I have designed my RESTful API so that you can reach the links associated with a user at the following URI: /...
Oliver Joseph Ash's user avatar
19 votes
2 answers
47k views

What is the best way to create REST API error response model and error codes system?

My REST implementation will return errors in JSON with next structure: { "http_response":400, "dev_message":"There is a problem", "message_for_user":"Bad request", "some_internal_error_code":...
Grokking's user avatar
  • 305
18 votes
4 answers
16k views

Is it a good idea to merge multiple HTTP requests to save bandwidth?

I am preparing a single page application that would be sometimes used over slow mobile connection. Some of its part are quite heavy in terms of API requests (fetching ten different resources for a new ...
Lukáš Lánský's user avatar
18 votes
1 answer
4k views

Is Open Data Protocol (odata) Being Widely Embraced by the Development Community? [closed]

EDIT: In case you aren't familiar with OData, here you go. I am trying to determine whether it is worth learning this technology or if it is something that is not going to catch on. The premise is ...
Matt Cashatt's user avatar
  • 3,315
17 votes
6 answers
7k views

Are Java's public fields just a tragic historical design flaw at this point? [closed]

It seems to be Java orthodoxy at this point that one should basically never use public fields for object state. (I don't necessarily agree, but that's not relevant to my question.) Given that, would ...
Avi Flax's user avatar
  • 297
17 votes
2 answers
13k views

How should an API use http basic authentication

When an API requires that a client authenticates to it, i've seen two different scenarios used and I am wondering which case I should use for my situation. Example 1. An API is offered by a company ...
Paul Sylling's user avatar
16 votes
7 answers
4k views

Should functions of a C library always expect a string's length?

I'm currently working on a library written in C. Many functions of this library expect a string as char* or const char* in their arguments. I started out with those functions always expecting the ...
Benjamin Kloster's user avatar
16 votes
3 answers
33k views

How do web APIs work? [closed]

I have heard of many web APIs like that of Facebook, Twitter, etc., which helps third party access data and manipulate it. I would like to know how a web API works. What are the basics of a web API? ...
Harish Kurup's user avatar
  • 1,269
16 votes
2 answers
4k views

Should a RESTful API provide data for an entire form?

Let's say I have a JavaScript web application which entirely uses a RESTful API for data. Let's say this application has a data form, and let's say I'm editing a record at /product/12345. When ...
Chad Johnson's user avatar
16 votes
1 answer
6k 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 ...
Joseph Mansfield's user avatar
15 votes
3 answers
25k views

How to represent object references in JSON?

I am trying to figure out what's the best approach when dealing with object references in a JSON to be sent to my server for deserialization. To clarify, what I mean is how to refer to data contained ...
dabadaba's user avatar
  • 2,236
15 votes
4 answers
6k views

How to do external API testing (blackbox)

Assume you are using APIs from a vendor, how to make sure their API is working as expected? My main concern is sometimes the vendor pushed the changes to their code and break the API, we want to have ...
user34401's user avatar
  • 751
14 votes
4 answers
1k views

Using natural language grammar in fluent API

I'm tinkering with a query abstraction over WebSQL/Phonegap Database API, and I find myself both drawn to, and doubtful of, defining a fluent API that mimics the use of natural English language ...
fencliff's user avatar
  • 261
14 votes
6 answers
17k views

Should you retry 500 API errors?

My team and I are integrating with a 3rd party company and using their API to perform different CRUD operations. Their API isn't always reliable though. Maybe 0.1% of the time an API call just fails ...
Eric's user avatar
  • 361
14 votes
4 answers
17k views

Is it a good practice to make API response list of values as dictionary?

I have an API endpoint that returns some statistics. Currently the response looks like: Option 1: { "stats": [ { "name": "some-stats-key1", ...
Yann's user avatar
  • 563
14 votes
5 answers
3k views

Balancing dependency injection with public API design

I've been contemplating how to balance testable design using dependency injection with providing simple fixed public API. My dilemma is: people would want to do something like var server = new Server()...
kolektiv's user avatar
  • 143
14 votes
4 answers
12k views

Is it better to make database calls or external API calls first in the context of a single Web request?

Say you have a Web app that uses data from both a database and an external API, and for certain pieces of functionality, you need to call in to both in order to read/write the necessary data. Is it ...
EJay's user avatar
  • 293
14 votes
5 answers
3k views

In API design, when to use/avoid ad hoc polymorphism?

Sue is designing a JavaScript library, Magician.js. Its linchpin is a function which pulls a Rabbit out of the argument passed. She knows its users may want to pull a rabbit out of a String, a Number,...
GladstoneKeep's user avatar
14 votes
6 answers
3k views

How do you learn a language's standard framework/API/functionality? [closed]

I understand how to code. I know how to get around the basics of the languages I use regularly. I know how to write slightly-above-basic regular expressions, I can talk to databases, I can accept ...
Throwaway's user avatar
  • 141
14 votes
1 answer
3k views

API key - in content or header

Working on an API at the moment and just wanted to gather opinions on where the best place to transmit the API key should be. I know that is shouldn't go in the URL, this leaves the request header or ...
garryp's user avatar
  • 255
14 votes
2 answers
9k views

How to design API endpoints for post a child object and for getting all the children of all the parents?

For example I have entities: Client, Report. Client may have many Reports and I think the endpoint for a single Report management should be nested like this: /clients/{client_id}/reports/{report_id} ...
Yann's user avatar
  • 563
13 votes
8 answers
4k views

How do you remember numerous API? [duplicate]

There are lots of other APIs I need to use besides the Selenium test tool to be able to get tests working. Not using them for just one week and the mind has lost all of them. How is it possible to ...
Tarun's user avatar
  • 942
13 votes
5 answers
10k views

How to simulate a REST API?

I am working on a new project which will query data from a 3rd party REST API. This is for a real time sports data feed, so the feed only works when a game is actually taking place. Although the 3rd ...
dferraro's user avatar
  • 341
13 votes
3 answers
39k views

Is it safe to transmit access tokens via HTTP headers?

It's the first RESTful web service and I am concerned about security issues. Is it safe to transmit my access token via HTTP headers? For example: POST /v1/i/resource HTTP/1.1 Content-Type: ...
ahmedsaber111's user avatar
13 votes
2 answers
21k views

Structure of RESTful Service with Java Spring for Beginner

I am relatively new in terms of Java web development skills. I have a project that I think would make a good candidate for a RESTful service from what little I understand about APIs. I'm trying to get ...
aCarella's user avatar
  • 329
13 votes
2 answers
21k views

Best way to hide API key in source code

I need some ideas on how to protect a private API key in an application, specifically in a c# .NET application. Firstly, I understand that it is theoretically impossible to hide anything in the ...
Spencer's user avatar
  • 233
13 votes
5 answers
6k views

When is an API considered to be an embedded DSL?

What is the difference between an API and an embedded Domain Specific Language (DSL)? Is it just syntax? Consider an API like OpenGL. How is that different from a graphics DSL? In other words, if ...
Phyllostachys's user avatar
13 votes
5 answers
8k views

REST API concepts

I have three questions about REST API design that I'm hoping someone can shed some light on. I've searched relentlessly for many hours but haven't found answers to my questions anywhere (maybe I just ...
Justin Warkentin's user avatar
13 votes
4 answers
8k views

Is there an API for determining congressional districts? [closed]

I'm looking to determine the congressional district based on an address my user is providing. This will avoid having the user to look it up themselves. Does an API of this sort exist? Note Through ...
ardavis's user avatar
  • 233
13 votes
3 answers
27k views

REST API vs directly DB calls in Desktop Application

I am currently planing an application that will be used in a company. It is required to build a Desktop Application. At the moment they are not sure if the application should be available on mobile or ...
devz's user avatar
  • 243
13 votes
1 answer
22k views

API Authentication, One time token VS Dynamic tokens

We are working on a new project, we are two lead developers and got on a crossroad on how to use a token to secure the communication between the server and the client. First Suggestion: (The one time ...
SAFAD's user avatar
  • 485
13 votes
2 answers
23k views

Implementing the command pattern in a RESTful API

I'm in the process of designing an HTTP API, hopefully making it as RESTful as possible. There are some actions which functionality spreads over a few resources, and sometime needs to be undone. I ...
Mithir's user avatar
  • 1,339
13 votes
3 answers
7k views

Designing a REST API with resource relationships?

I'm working to design a REST API to be consumed by a React SPA. The client-side of the SPA queries data about a relationship between two entities: Team and Player where Teams have many Players and ...
Adam Thompson's user avatar

1
2
3 4 5
26