Skip to main content
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 ...
Jon Raphaelson's user avatar
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 ...
t3chb0t's user avatar
  • 44.3k
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 ...
Lyubomyr Shaydariv's user avatar
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: ...
Ludisposed's user avatar
  • 11.6k
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 ...
Der Kommissar's user avatar
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 ...
dfhwze's user avatar
  • 13.9k
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. ...
alx's user avatar
  • 486
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 ...
dfhwze's user avatar
  • 13.9k
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 ...
Daniel Walker's user avatar
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 ...
ShapeOfMatter's user avatar
6 votes

Basic API wrapper around a Restful service

I would personally prefer to use HttpClient directly as it provides full control and perfect testability - see here. We can define our REST API as: ...
Dmitry Nogin's user avatar
  • 6,131
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 ...
Gareth Rees's user avatar
  • 49.6k
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. ...
Bohdan Stupak's user avatar
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; ...
i.bondarenko's user avatar
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 ...
Jamie Twells's user avatar
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 ...
Jia Ni's user avatar
  • 306
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 ...
Kater Akeren's user avatar
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 ...
301_Moved_Permanently's user avatar
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 ...
Roland Illig's user avatar
  • 21.3k
5 votes

Python wrapper class around HTTP API

You're right, you can cut down on the repetition of code. Although bundling all of the functions into one like you mention would work, you lose a bit of the readability that keeping them as class ...
dpercy's user avatar
  • 158
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 ...
Frank's user avatar
  • 316
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 ...
Matt Cole's user avatar
  • 948
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 ...
Your Common Sense's user avatar
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 ...
Nagarajan's user avatar
5 votes

Spring boot application web service

PUT vs. POST @PutMapping("/fizzbuzz") public void createFizzBuzzItem(...) PUT and POST ...
Roman's user avatar
  • 2,843
5 votes

Auctionsite API Wrapper in Python

Payload This code is pretty hard to read (and possibly prone to encoding errors): ...
Kate's user avatar
  • 7,123
4 votes
Accepted

Exception handling in URL builder method

If we are speaking in terms of Clean Code, the entire method should be revised. Here are the main points that I can criticize: if ... else if ... branches are ...
Antot's user avatar
  • 3,657
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 ...
mr. Y's user avatar
  • 141
4 votes
Accepted

Basic API wrapper around a Restful service

Injecting the IRestClient doesn't seem to be of much use here as you are setting its BaseUrl to a hardcoded string of the ...
t3chb0t's user avatar
  • 44.3k
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 ...
Gareth Rees's user avatar
  • 49.6k

Only top scored, non community-wiki answers of a minimum length are eligible