Status: Submitted
Status: Duplicate
Status: In progress
Status: Implemented
Status: Rejected

Correct status codes in API calls (OTCS)

1
Posted May 15 by Matthew Barben.
Updated May 15.

Hi There,

I was wondering if it was possible to get more expressive status codes from Content Server when making API calls. For example making a call to a node that does not exist would better served with a 404: Not Found instead of a 400: Bad Request as the request is not strictly a bad request, but instead one that did not return a result.

More on Status Codes

Regards,

Matthew Barben

1 Comment

0

OT has changed this twice for api/v2/nodes/{nodeId}
Comments from my source code tell the tale.

// HttpStatusCode.InternalServerError means node not found on OTCS V16.2.4
// This was sloppy since this should be NotFound (404) IMO
// In 16.2.9 They must have heard me ;)

Since my code handles different codes differently, this was a breaking change. Yet OT didn't think to:

  • a.) Document it. - We asked support. It is not in the release notes.
    We asked

  • b.) Use semantic version numbers, to indicate breaking
    changes at least for the API.

ping reports: "{ Build = 2, Href = api/v1, Version = 1 }")

This is where I would look to write client code which operates against different versions of OTCS REST API.

The upgrade from 16.2.4 to 16.2.9 also changed all POST methods (at least the subset we use) to no longer accept query parameters. You must use form variables (header).

For a REST API, where the query parameters are not visible anyway, IMO, it seems silly to me to not accept Query Parameters.
My opinion aside, even if this an improvement, more secure etc. There is no excuse for introducing breaking changes to a public interface/API without release notes and a new version number.

If there are Release Notes now available that OT Support could not provide per our request, I would appreciate being corrected.

If you do not already appreciate the value of API level testing, an OTCS update will make you a believer.


 You have subscribed and will receive email notifications of updates to this topic. To unsubscribe, uncheck the checkbox.

Statistics

Related categories

Related tags

Your comment

To leave a comment, please sign in.