-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzestful.openapi.json
146 lines (146 loc) · 8.13 KB
/
zestful.openapi.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{
"openapi": "3.0.2",
"info": {
"title": "Zestful",
"version": "0.1.0"
},
"paths": {
"/parseIngredients": {
"post": {
"summary": "Parse Ingredients",
"description": "Parses a list of raw ingredient strings into structured JSON.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"ingredients": {
"title": "ingredients",
"type": "array",
"description": "List of ingredients to parse.\n- This list must contain between 1 and 100 elements.\n- Each string in the list must be 1,024 characters or fewer.\n- Unicode strings are supported.\n- The strings may be HTML- or URL-encoded.\n- Any HTML tags in the ingredient strings will be ignored.",
"items": {
"type": "string"
}
}
},
"required": ["ingredients"],
"additionalProperties": false
},
"example": {
"ingredients": [
"3 large Granny Smith apples",
"2 1/2 tablespoons finely chopped parsley",
"½ tsp brown sugar"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"results": {
"title": "results",
"type": "array",
"description": " If the request was successful, contains a list of dictionaries with the keys `ingredientRaw`, `ingredientParsed`, and `error`.",
"items": {
"type": "object",
"properties": {
"ingredientRaw": {
"type": "string"
},
"ingredientParsed": {
"type": "object",
"description": "A dictionary containing the ingredient as structured data.",
"properties": {
"quantity": {
"description": "A number representing the quantity represented in the ingredient string, or null if no quantity was detected in the ingredient string.",
"oneOf": [
{ "type": "string" },
{ "type": null }
]
},
"unit": {
"description": "A string containing the unit of measure in the ingredient string, or null if no unit of measure was found.\nThe unit of measure is always in singular form (e.g., `teaspoon`, not `teaspoons`).",
"oneOf": [
{ "type": "string" },
{ "type": null }
]
},
"productSizeModifier": {
"description": "Adjectives that describe product's size (e.g., `large`, `small`).",
"type": "string"
},
"product": {
"description": "The product a user buys to obtain this ingredient (e.g., `ground beef`, `brown sugar`).",
"type": "string"
},
"preparationNotes": {
"description": "Instructions to the user about how to prepare this ingredient for a recipe (e.g., `finely chopped`, `halved`).\n\n- Preparation notes refer to actions that a user takes after purchasing an ingredient. In some cases, such as “ground cinnamon” this is ambiguous because a user can purchase whole cinnamon sticks and grind them (which would treat grinding as a preparation step) or a user can purchase the product `ground cinnamon` (which has no preparation steps).\n\n- For ambiguous cases, the parser attempts to choose the product that is more common. For example, “ground cinnamon” is treated as a product name because most users purchase cinnamon pre-ground. In contrast, “diced celery” is interpreted as product=`celery`, preparationNotes=`diced` because users more commonly dice celery instead of buying pre-diced celery.",
"type": "string"
},
"usdaInfo": {
"description": "If Zestful can match the ingredient to a food in the USDA database, this contains a dictionary of information about the matching USDA entry",
"type": "object",
"properties": {
"fdcId": {
"description": "The FDC ID for the food in the USDA FoodData Central database (e.g., `168833`)",
"type": "string"
},
"matchMethod": {
"description": "The method that Zestful used to match the ingredient to a USDA entry. This can be one of the following values:\n\n- `exact`: Zestful found an exact match for this product in the USDA database.\n- `closestUnbranded`: Zestful could not find an exact equivalent USDA entry, so it matched the ingredient to a closely related unbranded USDA product.\n- e.g., USDA has no exact match for `light brown sugar`, so Zestful would match this ingredient to `Sugars, brown`.\n- `closestBranded`: Zestful could not find an exact or unbranded equivalent USDA entry, so it matched the ingredient to a branded USDA product.\n- e.g., USDA has no exact match for `apple cider vinegar`, so Zestful would match this ingredient to `BRAGG, ORGANIC APPLE CIDER VINEGAR`.",
"type": "string",
"enum": [
"exact",
"closestUnbranded",
"closestBranded"
]
},
"category": {
"description": "The USDA category for the ingredient (e.g., `Sweets`).",
"type": "string"
},
"description": {
"description": "The name of the ingredient in the USDA database (e.g., `Sugars, brown`).",
"type": "string"
}
}
},
"confidence": {
"description": "A value between 0.0 and 1.0 representing Zestful’s confidence in the result (higher is better).",
"type": "number"
},
"error": {
"description": "An error message that describes what caused `ingredientRaw` to fail parsing.",
"type": "string"
}
}
}
}
},
"error": {
"type": "string",
"description": "An error message that describes what caused the full parse request to fail."
}
}
}
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https://sandbox.zestfuldata.com"
}
]
}