Difference between revisions of "API Design experience"

From Open Food Facts wiki
Jump to navigation Jump to search
Line 14: Line 14:
 
=== Response wrapper ===
 
=== Response wrapper ===
 
The wrapper contains the meta data of the response, i.e. whether the request was successful, how many results are available, etc.
 
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 ===
 
[[Category:API]]
 
[[Category:API]]

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)

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