API Design experience: Difference between revisions

From Open Food Facts wiki
No edit summary
Line 9: Line 9:
=== API version number ===
=== API version number ===
Add the API version number to each call as a path (Robotoff)
Add the API version number to each call as a path (Robotoff)
=== Path parameters vs Queries ===


== Output ==
== Output ==

Revision as of 13:31, 26 November 2022

Introduction

This page reflects my experience in using the various API suites (product, search, image, robotoff, folksonomy) available on OFF. These implementations can sometimes be streamlined and synchronised.

My experience is based on implementing the API's in Swift 4.0 on Xcode. I want to be able to implement the API's only with the Swift libraries and minimal coding. If I need to cater for an exception in the API or the Json -results, then there is something wrong in the API design.

API Call

Is it possible to streamline the various API calls?

API version number

Add the API version number to each call as a path (Robotoff)

Path parameters vs Queries

Output

Single Json response

Response wrapper

The wrapper contains the meta data of the response, i.e. whether the request was successful, how many results are available, etc.

Free dictionaries

Dependent field names