For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.getply.com/api-reference/swagger-plant-store-open-api-3-1/plant/llms.txt. For full documentation content, see https://docs.getply.com/api-reference/swagger-plant-store-open-api-3-1/plant/llms-full.txt.

# Update an existing plant

PUT https://api.plantstore.dev/v3/plant
Content-Type: application/json

Reference: https://docs.getply.com/api-reference/swagger-plant-store-open-api-3-1/plant/update-plant

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: example-openapi
  version: 1.0.0
paths:
  /plant:
    put:
      operationId: update-plant
      summary: Update an existing plant
      tags:
        - subpackage_plant
      responses:
        '200':
          description: Plant successfully updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlantResponse'
        '400':
          description: Invalid ID supplied
          content:
            application/json:
              schema:
                description: Any type
        '404':
          description: Plant not found
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        description: Updated details of the plant
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Plant'
servers:
  - url: https://api.plantstore.dev/v3
components:
  schemas:
    PlantStatus:
      type: string
      enum:
        - available
        - pending
        - sold
      title: PlantStatus
    Plant:
      type: object
      properties:
        name:
          type: string
        category:
          type: string
        tags:
          type: array
          items:
            type: string
        status:
          $ref: '#/components/schemas/PlantStatus'
      title: Plant
    PlantResponse:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        status:
          type: string
        tags:
          type: array
          items:
            type: string
      title: PlantResponse

```

## SDK Code Examples

```python Successful Plant Update
import requests

url = "https://api.plantstore.dev/v3/plant"

headers = {"Content-Type": "application/json"}

response = requests.put(url, headers=headers)

print(response.json())
```

```javascript Successful Plant Update
const url = 'https://api.plantstore.dev/v3/plant';
const options = {method: 'PUT', headers: {'Content-Type': 'application/json'}, body: undefined};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Successful Plant Update
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.plantstore.dev/v3/plant"

	req, _ := http.NewRequest("PUT", url, nil)

	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 Successful Plant Update
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::Put.new(url)
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
```

```java Successful Plant Update
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.plantstore.dev/v3/plant")
  .header("Content-Type", "application/json")
  .asString();
```

```php Successful Plant Update
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.plantstore.dev/v3/plant', [
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Successful Plant Update
using RestSharp;

var client = new RestClient("https://api.plantstore.dev/v3/plant");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Successful Plant Update
import Foundation

let headers = ["Content-Type": "application/json"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.plantstore.dev/v3/plant")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

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()
```

```python Update plant status
import requests

url = "https://api.plantstore.dev/v3/plant"

payload = {
    "name": "Fern",
    "category": "Indoor",
    "tags": ["green", "leafy"],
    "status": "sold"
}
headers = {"Content-Type": "application/json"}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Update plant status
const url = 'https://api.plantstore.dev/v3/plant';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json'},
  body: '{"name":"Fern","category":"Indoor","tags":["green","leafy"],"status":"sold"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Update plant status
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\": \"sold\"\n}")

	req, _ := http.NewRequest("PUT", 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 Update plant status
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::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Fern\",\n  \"category\": \"Indoor\",\n  \"tags\": [\n    \"green\",\n    \"leafy\"\n  ],\n  \"status\": \"sold\"\n}"

response = http.request(request)
puts response.read_body
```

```java Update plant status
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("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\": \"sold\"\n}")
  .asString();
```

```php Update plant status
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.plantstore.dev/v3/plant', [
  'body' => '{
  "name": "Fern",
  "category": "Indoor",
  "tags": [
    "green",
    "leafy"
  ],
  "status": "sold"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Update plant status
using RestSharp;

var client = new RestClient("https://api.plantstore.dev/v3/plant");
var request = new RestRequest(Method.PUT);
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\": \"sold\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update plant status
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "name": "Fern",
  "category": "Indoor",
  "tags": ["green", "leafy"],
  "status": "sold"
] 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 = "PUT"
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()
```