All Questions
Tagged with api programming-practices
24 questions
0
votes
4
answers
214
views
How to eliminate repetition in three subclasses: each defines an identical method that does almost the same thing, but with a different return type
TLDR:
I have three subclasses, each inherits from the same parent class, each defines an identical method that does almost the same thing, except that each of these methods has a different return type....
-1
votes
1
answer
115
views
Is there any benefit/viability to sharing models across API versions that have differing schemas
I have been asked to get involved with a Team that is currently having delivery issues for various reasons. During my review I came across an acceptance criteria on a user story;
If you call v1 of ...
4
votes
4
answers
1k
views
API Design: Sending errors in the response
Suppose I have a products API:
/products
GET: List of products
POST: Creates a product
/products/12345
GET: Get a specific product
PUT: Updates a specific product
So is this a good idea for the ...
1
vote
2
answers
3k
views
One API or Two APIs one for internal use and the other for external use
I follow the Layered architecture Like this:
But with two differences:
I use Blazor Assembly for UI Layer.
I have API layer(REST) In between the presentation layer and the service layer.
My ...
-2
votes
1
answer
68
views
How do you enforce API contracts across mutliple stacks?
For systems that are built on top of diverse tech stacks, including both static and dynamic types languages, what is in practice some ways to have the API contracts published and enforced?
Some wiki ...
0
votes
2
answers
116
views
How sensible is it to build a website/app etc. using an external api?
Wanting to expand my programming horizons I recently started building a website.
I have started to build up my website and it is heavily focused around an external api.
The reason for using this api ...
8
votes
6
answers
4k
views
Should error codes in JSON be integers or strings?
I'm designing a backend webservice, and when an error occurs I'm returning it as a JSON to the frontend. This JSON contains an error code, which the frontend maps to an localized string and shows that ...
1
vote
2
answers
189
views
My implementation accepts only URLClassLoader, may I be less restrictive in my method signature?
I wrote a Java API that accepts ClassLoaders as parameter, even though it won't accept any ClassLoader that isn't a URLClassLoader (because I'm only interested in the URLClassLoader::getURLs() method):...
1
vote
3
answers
153
views
I've decided to write two methods, one doing a subset of the other. Which should I write first?
I've decided to write two methods, one providing general functionality, and one doing something more specific and narrow that can be done with the more complex method, though maybe with worse ...
7
votes
1
answer
6k
views
Breaking a Large Python Project into Multiple Packages
I have a medium sized Python program (12 KLOC) organized as a single Python package with multiple subpackages:
proj/
setup.py
proj/
__init__.py
projfile1.py
subproj1/
...
0
votes
1
answer
89
views
API design - return which operations the user can perform
My Rest API returns a tree structure like this:
[
{
"name":"test old",
"id": 1,
"type":"a-object",
"spend":13,
"status”: “active”,
"children":[
{
"name":...
1
vote
1
answer
847
views
Data Transfer Between Loosely Coupled Modules of an Application
Let's say we have a rather large project written in Python using the Django framework that is made up of multiple modules (proper term in Django is a project made up of multiple apps, but for the sake ...
2
votes
1
answer
336
views
REST API URL parameter
We've come across the following case when working on REST API.
Users have the ability to expand the product deployment by installing custom JSON configurations. These configurations tend to be ...
2
votes
2
answers
165
views
Trouble conceptualising API's
I've been reading a number of articles on "what is an API" but they're either too high level or two low level for me... I can't seem to quite grasp the entire concept, or have that sneaking feeling ...
5
votes
2
answers
1k
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 ...