MedPlus Mart Categories
medplus.categories.list
List the MedPlus Mart category tree with parent ids and depth, so a caller can pick a category and walk its products.
At a glance
- Endpoint ID
medplus.categories.list- Price
- 1 credit per call; failed calls are free
- Runs for up to
- 45 seconds
Request
Send the endpoint ID as capability and its fields as input. Set UPSCRAPE_API_KEY to your key first.
curl --request POST \ --url https://data.upscrape.com/execute \ --header "Authorization: Bearer $UPSCRAPE_API_KEY" \ --header "Content-Type: application/json" \ --header "Prefer: wait=30" \ --data '{ "capability": "medplus.categories.list", "input": { "max_depth": 2 }}'
import jsonimport osimport requestspayload = json.loads(r'''{ "capability": "medplus.categories.list", "input": { "max_depth": 2 }}''')response = requests.post( "https://data.upscrape.com/execute", headers={ "Authorization": f"Bearer {os.environ['UPSCRAPE_API_KEY']}", "Content-Type": "application/json", "Prefer": "wait=30", }, json=payload,)response.raise_for_status()print(json.dumps(response.json(), indent=2))
const response = await fetch("https://data.upscrape.com/execute", { method: "POST", headers: { "Authorization": `Bearer ${process.env.UPSCRAPE_API_KEY}`, "Content-Type": "application/json", "Prefer": "wait=30", }, body: JSON.stringify({ "capability": "medplus.categories.list", "input": { "max_depth": 2 }}),});if (!response.ok) { throw new Error(`Upscrape request failed: ${response.status}`);}console.log(JSON.stringify(await response.json(), null, 2));
Input
| Field | Type | Required | What it does | Example |
|---|---|---|---|---|
max_depth |
integer | no | How many levels of the tree to return, counting the top level as 1. From 1 to 3. Default: 3. |
2 |
parent_id |
string | no | Return only this category's subtree: a numeric id, a MART_ prefixed id or a public medplusmart.com category link. |
Response
A finished call answers with HTTP 200; the data is in results[0].data, and billing.credits_charged is what it cost. A call still running after the wait answers 202: see jobs and results.
This is results[0].data from a real run:
{ "total_count": 6, "categories": [ { "name": "Factory Direct", "category_id": "10110", "depth": 0, "image_url": "https://static2.medplusmart.com/live/bannerImage/Mart/ba83af20ac88355613892ade603455d0.jpg" }, { "name": "Accessories", "category_id": "20093", "depth": 1, "parent_id": "10110" } ]}
Fields
| Field | Type | Example |
|---|---|---|
categories[].name |
string | Factory Direct |
categories[].category_id |
string | 10110 |
categories[].depth |
integer | 0 |
categories[].image_url |
string | https://static2.medplusmart.com/live/bannerImage/Mart/ba83af20a… |
categories |
array | 3 records |
total_count |
integer | 6 |
If a call fails
A failed call costs nothing. The response carries an error.code you can branch on; Errors and retries lists every code and which ones to retry.
Other MedPlus Mart endpoints
Something missing or unclear? Ask the team that builds the MedPlus Mart endpoints.