Plant Catalog Management Guide

Step-by-step tutorial for creating, updating, tagging, and filtering plant inventory.

View as Markdown

This guide walks you through managing the plant inventory catalog using the REST API endpoints.


1. Adding a New Plant

To add a plant item to the inventory catalog, send a POST request to /plant with the required metadata schema.

Request Payload (POST /v3/plant)
1{
2 "id": 10,
3 "name": "Ficus Elastica (Rubber Tree)",
4 "category": {
5 "id": 1,
6 "name": "Indoor Trees"
7 },
8 "photoUrls": [
9 "https://assets.plantstore.dev/images/ficus-elastica-1.jpg",
10 "https://assets.plantstore.dev/images/ficus-elastica-2.jpg"
11 ],
12 "tags": [
13 {
14 "id": 101,
15 "name": "easy-care"
16 },
17 {
18 "id": 102,
19 "name": "bright-indirect-light"
20 }
21 ],
22 "status": "available"
23}

Code Example

$curl -X POST "https://api.plantstore.dev/v3/plant" \
> -H "Content-Type: application/json" \
> -H "Authorization: Bearer <OAUTH2_TOKEN>" \
> -d '{
> "id": 10,
> "name": "Ficus Elastica",
> "photoUrls": ["https://assets.plantstore.dev/images/ficus.jpg"],
> "status": "available"
> }'

2. Searching & Filtering Plants

Search by Status

Retrieve all plants matching specific inventory statuses (available, pending, sold):

1GET /v3/plant/findByStatus?status=available,pending HTTP/1.1
2Host: api.plantstore.dev
3Accept: application/json
Response Payload (200 OK)
1[
2 {
3 "id": 10,
4 "name": "Ficus Elastica (Rubber Tree)",
5 "status": "available"
6 },
7 {
8 "id": 12,
9 "name": "Monstera Deliciosa",
10 "status": "pending"
11 }
12]

Search by Tags

Find plants based on one or more category tags:

1GET /v3/plant/findByTags?tags=easy-care,pet-friendly HTTP/1.1
2Host: api.plantstore.dev
3Accept: application/json

3. Uploading Plant Images

Attach high-resolution product photographs to an existing plant record via POST /plant/{plantId}/uploadImage:

Upload Image via multipart/form-data
$curl -X POST "https://api.plantstore.dev/v3/plant/10/uploadImage" \
> -H "Authorization: Bearer <OAUTH2_TOKEN>" \
> -F "additionalMetadata=High-res product photo" \
> -F "file=@/path/to/ficus.jpg"
Response Payload
1{
2 "code": 200,
3 "type": "SUCCESS",
4 "message": "additionalMetadata: High-res product photo\nFile uploaded to https://assets.plantstore.dev/images/upload_10.jpg"
5}

4. Updating & Deleting Plants

  • Update Existing Plant: PUT /plant (updates all plant attributes).
  • Update Status via Form Data: POST /plant/{plantId} (updates name and status via URL-encoded form data).
  • Delete Plant: DELETE /plant/{plantId} (requires valid api_key or write:plants scope).

Deleting a plant that has active pending orders will result in a 409 Conflict error. Ensure all orders are completed or cancelled prior to deleting plant inventory.