Update Product

Update a single product on your Terraswitch account.

PUT {{ BASE_URL }}/v1/corporate/product/{code}

Url Parameters

Property
Data Type
Description
Example
Required

code

string

The product code

"TPDMYPROPLASTXD"

Yes

Body Parameters

Property
Data Type
Description
Example
Required

name

string

The name of the product

"Laptop Bag"

No

avatar

base64 string

The base64 string value of the product image. Recommended size is 5MB.

"base64..."

No

description

string

The product description

"This is a new product"

No

price

number

The price of the product. This must be in 2 decimal places only.

4500.99

No

import Axios from 'axios';

// set the api url
const API_URL = `${BASE_URL}/v1/corporate/product/${code}`;

// define request body
const base64_image = "base64...";
const data = {
    "name": "Plastic Chair",  
    "avatar": `${base64_image}`,
    "description": "", 
    "price": 5000.00
}

// make request using axios
Axios({
    method: "GET",
    url: `${API_URL}`,
    headers: {
        lg: 'en',
        ch: 'web'
        Authorization: `Bearer ${API_KEY}`,
        'Content-Type': 'application/json',
    },
    data: data
}).then((resp) => {
    console.log(resp)
}).catch((err) => {
    console.log(err)
})

Last updated