Read an ingredient line
const url = 'http://127.0.0.1:8080/api/v1/ingredient-lines/parse';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"convention":"metric","language":"example","source_locale":"example","text":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://127.0.0.1:8080/api/v1/ingredient-lines/parse \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "convention": "metric", "language": "example", "source_locale": "example", "text": "example" }'Reads one typed ingredient line into an amount, unit, name, and note using the unit words of the line’s language. Nothing is stored. The result is the reading an import would make, so a line typed in the editor and the same line imported are read alike.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
An explicit author choice for every applicable unqualified measure of this submitted ingredient line. It outranks source-locale lookup and preserves explicit unit definitions. Omit it when unspecified
BCP 47 tag of the language the line is written in. Its primary language selects unit words and reading order; its region does not establish a measuring convention
BCP 47 tag of the locale the recipe declares. It takes the place of language when the two are sent
One ingredient line as a person writes it, such as 2 cups flour, sifted or 小麦粉 200g
Responses
Section titled “Responses”OK
object
The line read as an ingredient. Its normalization method is extracted when an amount was read and unresolved when the line named a measure that could not be identified safely. A line with no amount is returned as a name
object
object
The author sanctioned leaving this occurrence out. It belongs to the occurrence, never to the ingredient: the same thing may be optional in a garnish section and required by the method
object
object
object
object
object
object
object
object
object
object
The recipe that makes this ingredient, as the source identified it. Its content is not included
object
The other recipe’s portable document ID, not a library entry ID
The other recipe’s title as authored
Where the other recipe is published
object
object
object
Example
{ "ingredient": { "normalization": { "method": "authored", "review": "confirmed" }, "package_size": { "kind": "simple" }, "quantity": { "kind": "simple", "options": [ { "kind": "simple", "terms": [ { "kind": "simple" } ] } ], "terms": [ { "kind": "simple" } ] }, "relation": "or", "temperature": { "purpose": { "kind": "oven" } } }}No valid session or API token (authentication-required), or the credential sent is invalid (invalid-credentials).
object
Examplegenerated
{ "code": "example", "detail": "example", "status": 1, "title": "example", "type": "example"}default
Section titled “default”Error
object
Stable application error code; clients may also use the problem type suffix.
A human-readable explanation specific to this occurrence of the problem.
Optional list of individual error details
object
Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’
Error message text
The value at the given location
A URI reference that identifies the specific occurrence of the problem.
Structured context for the stable error code.
object
HTTP status code
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
A URI reference to human-readable documentation for the error.
object
object
Example
{ "detail": "Property foo is required but is missing.", "instance": "https://example.com/error-log/abc123", "status": 400, "title": "Bad Request", "type": "about:blank"}