ProductOpener::APIProductServices - Microservices to enrich a product object
This module implements a microservice API for operations done on an product object.
Applications can send product data (for instance a nested list of ingredients), ask for one or more services to be executed on the input product data (for instance computing the min, max and estimated percentages of each ingredient), and get back resulting product data (possibly filtered to get only specific fields back).
The Routing.pm and API.pm module offer an HTTP interface of this form: POST /api/v3/product_services
The POST body is a JSON object with those fields:
An array list of services to perform.
Currently implemented services:
- echo : does nothing, mostly for testing - parse_ingredients_text : parse the ingredients text list and return an ingredients object - extend_ingredients : extend the ingredients object with additional information - estimate_ingredients_percent : compute percent_min, percent_max, percent_estimate for each ingredient in the ingredients object - analyze_ingredients : analyze the ingredients object and return a summary object
A product object
An array list of fields to return. If empty, only fields that can be created or updated by the service are returned. e.g. a service to parse the ingredients text list will return the "ingredients" object.
The response is in the JSON API v3 response format, with a resulting product object.
Echo service that returns the input product unchanged.
They will be called with the input product object, a reference to the updated fields hash, and a reference to the errors array.
Process API v3 product services requests.