> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.barayuda.web.id/api-reference/swagger-plant-store-open-api-3-1/plant/add-plant/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.barayuda.web.id/_mcp/server. # Add a new plant to the store POST https://api.plantstore.dev/v3/plant Content-Type: application/json Reference: https://docs.barayuda.web.id/api-reference/swagger-plant-store-open-api-3-1/plant/add-plant ## Request ### Body (application/json) This endpoint expects a Plant. - `name` (string, optional) - `category` (string, optional) - `tags` (list of string, optional) - `status` (enum, optional) - Allowed values: `available`, `pending`, `sold` ## Response ### 200 Plant successfully added - `id` (integer, optional) - `name` (string, optional) - `status` (string, optional) - `tags` (list of string, optional) ## Errors ### 405 Method Not Allowed Error Invalid input - `any` ## Examples ### Successful Plant Addition **Response** ```json { "id": 101, "name": "Fern", "status": "available", "tags": [ "green", "leafy" ] } ``` **SDK Code** ```python Successful Plant Addition import requests url = "https://api.plantstore.dev/v3/plant" response = requests.post(url) print(response.json()) ``` ```javascript Successful Plant Addition const url = 'https://api.plantstore.dev/v3/plant'; const options = {method: 'POST'}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Successful Plant Addition package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.plantstore.dev/v3/plant" req, _ := http.NewRequest("POST", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Successful Plant Addition require 'uri' require 'net/http' url = URI("https://api.plantstore.dev/v3/plant") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body ``` ```java Successful Plant Addition import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.plantstore.dev/v3/plant") .asString(); ``` ```php Successful Plant Addition request('POST', 'https://api.plantstore.dev/v3/plant'); echo $response->getBody(); ``` ```csharp Successful Plant Addition using RestSharp; var client = new RestClient("https://api.plantstore.dev/v3/plant"); var request = new RestRequest(Method.POST); IRestResponse response = client.Execute(request); ``` ```swift Successful Plant Addition import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.plantstore.dev/v3/plant")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ### Add a Fern Plant **Request** ```json { "name": "Fern", "category": "Indoor", "tags": [ "green", "leafy" ], "status": "available" } ``` **Response** ```json { "id": 101, "name": "Fern", "status": "available", "tags": [ "green", "leafy" ] } ``` **SDK Code** ```python Add a Fern Plant import requests url = "https://api.plantstore.dev/v3/plant" payload = { "name": "Fern", "category": "Indoor", "tags": ["green", "leafy"], "status": "available" } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Add a Fern Plant const url = 'https://api.plantstore.dev/v3/plant'; const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"name":"Fern","category":"Indoor","tags":["green","leafy"],"status":"available"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Add a Fern Plant package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.plantstore.dev/v3/plant" payload := strings.NewReader("{\n \"name\": \"Fern\",\n \"category\": \"Indoor\",\n \"tags\": [\n \"green\",\n \"leafy\"\n ],\n \"status\": \"available\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Add a Fern Plant require 'uri' require 'net/http' url = URI("https://api.plantstore.dev/v3/plant") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"name\": \"Fern\",\n \"category\": \"Indoor\",\n \"tags\": [\n \"green\",\n \"leafy\"\n ],\n \"status\": \"available\"\n}" response = http.request(request) puts response.read_body ``` ```java Add a Fern Plant import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.plantstore.dev/v3/plant") .header("Content-Type", "application/json") .body("{\n \"name\": \"Fern\",\n \"category\": \"Indoor\",\n \"tags\": [\n \"green\",\n \"leafy\"\n ],\n \"status\": \"available\"\n}") .asString(); ``` ```php Add a Fern Plant request('POST', 'https://api.plantstore.dev/v3/plant', [ 'body' => '{ "name": "Fern", "category": "Indoor", "tags": [ "green", "leafy" ], "status": "available" }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Add a Fern Plant using RestSharp; var client = new RestClient("https://api.plantstore.dev/v3/plant"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"Fern\",\n \"category\": \"Indoor\",\n \"tags\": [\n \"green\",\n \"leafy\"\n ],\n \"status\": \"available\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Add a Fern Plant import Foundation let headers = ["Content-Type": "application/json"] let parameters = [ "name": "Fern", "category": "Indoor", "tags": ["green", "leafy"], "status": "available" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.plantstore.dev/v3/plant")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```