22
votes
Accepted
REST API to list books, where null means "everything"
I personally think it's fine, but it helps to turn your thinking around from a "selector" to a "filter". Then, the default is to return all books, and you selectively filter down the set you're going ...
14
votes
Accepted
ASP.NET REST controller with try-catch error handling
throw ex;
This is a fatal mistake. It'll create a new stack-trace and you won't be able to tell where the actual exception occured. If you want to rethrow it then ...
9
votes
Spring Boot RESTful service
Should be changed:
Request mappings are not that RESTful due to the verbs:
POST /api/cars/add-car => POST /api/cars
...
9
votes
Star Wars API GET request in Python
This is pretty good. I only have a few small nitpicks
Return directly
You do this a few times:
...
7
votes
Accepted
A PHP API which has an endpoint for processing a user's facebook login details
A lot of times people post PHP here and it's often very ugly, this is not one of those times.
Your classes and design are beautiful, and it's very obvious what your intentions are. You've built a ...
7
votes
HttpClient reusable instance for simple calls on another methods
Dispose Strategy
It seems your class doesn't even need to implement IDisposable. Should dispose HttpClient?
Single Responsibility
I would extract configuration ...
7
votes
Build a set of REST interfaces using Symfony framework
I'll try to cover the response part.
SingleProduct and BundleProduct should be polymorphic.
...
7
votes
Accepted
Generic method to call API functions with simple retrial on errors
Inversion-of-control
I wouldn't use reflection using error-prone member-by-string lookup, when a simple Func provides type-safe behavior. This signature could be ...
7
votes
Auctionsite API Wrapper in Python
In API.__init__, you're assigning a value to self.base_url. However, that value is never changed and thus is the same for every ...
7
votes
Accepted
Python script to get and save data from a web API
This is pretty good!
For the purpose of your job, I would suggest leaving this alone unless or until you decide it's broken in some way. It's certainly "good enough".
As a learning ...
6
votes
Accepted
Bitex - Cryptocurrency Exchange API Framework for Python
There's a lot of code here, so I'm just going to review bitex.utils. You'll see that there's plenty here for one review. Maybe some of the other reviewers here at ...
6
votes
Accepted
Mini HttpClient json post by Action parameter
Great job. Here are some minor notes though.
In newer versions of C# you can leverage async Main in order not to wait for your test method.
...
6
votes
Accepted
Rest Api with generic crud operations
Your code is good, but some improvements could be made.
Here are my suggestions:
Use lowercase for first letter of variable. Example:
BrandService BrandService; ...
6
votes
Accepted
Testable REST API Client
You require the interface to be IDisposable which is a bit of a shame. You're only doing this so that you can dispose of the HttpClient, but as it says in the ...
6
votes
Spring boot application web service
fizzBuzzOutputsRepo is an in-memory map and there is no data persistence. So if the web server crashes, then there will be data loss.
Even if data persistence is ...
6
votes
Accepted
Using Node.js, Express, and Express Router to implement a very simple REST API
After I examine the codes you have written, I could see some things that are not rightly done. Below are the few things I highlighted:
The structuring of the codebase is not okay hence it can be ...
5
votes
Python Stock Checker
Your code looks hard to read and not like Python code.
The main reason for this is that every second line is a comment. Most of these comments just repeat what the surrounding code does. These ...
5
votes
Accepted
Library to be used against a specific REST web service
Creating a session
As a library, I find it barely usable. If I want to use it with my own credentials, I have to:
either modify the source of your library to put them in ...
5
votes
Accepted
Restful CRUD API with Node.js and Express
I know you are generating data for the sake of completion but it does complicate things on what aspect of the code you'd like to focus on. But here are a couple thoughts.
With Express, I often like ...
5
votes
ASP.NET REST controller with try-catch error handling
Typically in an ASP.NET app (and in fact in any app), you should only catch and handle the base System.Exception in a single place as close to the application entry ...
5
votes
Accepted
Simple CRUD back-end for an inventory-tracking web API
Disclaimer: there will be a lot of links to my own site because I am helping people with PHP for 20+ years and got an obsession with writing articles about most common issues.
I don't know much ...
5
votes
Spring boot application web service
From API design perspective let me pitch in
Have a base path and then have the resource name in the
corresponding request mapping.
Base path /api
version /v1
request mapping /fizzBuzz
Add HTTP ...
5
votes
Spring boot application web service
PUT vs. POST
@PutMapping("/fizzbuzz")
public void createFizzBuzzItem(...)
PUT and POST ...
5
votes
Auctionsite API Wrapper in Python
Payload
This code is pretty hard to read (and possibly prone to encoding errors):
...
4
votes
Accepted
JSON REST client proxy generator
Usually when I see your questions there isn't much for me to say, because you usually flesh everything out really well. :) (Probably why this has been unanswered so long.)
That said, I think I do ...
4
votes
Python wrapper class around HTTP API
A couple of comments on requests usage:
if resp.status_code != requests.codes.ok:
resp.raise_for_status()
Here checking that status code is not 200 won't do ...
4
votes
Accepted
Bitex - Cryptocurrency Exchange API Framework for Python - Round 2
There's a lot of code here, so I'm just going to review bitex.api. You'll see that there's plenty here for one review. Maybe some of the other reviewers here at ...
4
votes
Accepted
cURL based REST client library
When I look at the RestClient class, what is required to make a request?
$client = new RestClient();
$client->get("http://codereview.stackexchange.com");
At ...
4
votes
Elegantly handle github API requests exceptions
One way to slightly speed-up is by reducing the overhead of the requests module. Currently your code has to establish a connection once for every team, re-...
4
votes
Rest API for realtime statistics of last 60 seconds
Gathering statistics
The DoubleSummaryStatisticsClass class will be a perfect replacement for your bespoke Statistics class, ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
rest × 255java × 70
api × 62
python × 52
c# × 42
php × 33
spring × 33
javascript × 24
python-3.x × 16
json × 16
performance × 15
beginner × 13
go × 12
node.js × 10
http × 10
asp.net-web-api × 10
object-oriented × 8
error-handling × 8
mongodb × 8
laravel × 7
web-services × 7
spring-mvc × 7
multithreading × 6
.net × 6
unit-testing × 6