Create Vendor
curl --request POST \
--url https://staging-api.puppetvendors.com/v1/vendors \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"vendorName": "<string>",
"commissionType": "<string>",
"commissionAmount": 123
}
'import requests
url = "https://staging-api.puppetvendors.com/v1/vendors"
payload = {
"vendorName": "<string>",
"commissionType": "<string>",
"commissionAmount": 123
}
headers = {
"x-access-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({vendorName: '<string>', commissionType: '<string>', commissionAmount: 123})
};
fetch('https://staging-api.puppetvendors.com/v1/vendors', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging-api.puppetvendors.com/v1/vendors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'vendorName' => '<string>',
'commissionType' => '<string>',
'commissionAmount' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging-api.puppetvendors.com/v1/vendors"
payload := strings.NewReader("{\n \"vendorName\": \"<string>\",\n \"commissionType\": \"<string>\",\n \"commissionAmount\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging-api.puppetvendors.com/v1/vendors")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"vendorName\": \"<string>\",\n \"commissionType\": \"<string>\",\n \"commissionAmount\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-api.puppetvendors.com/v1/vendors")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"vendorName\": \"<string>\",\n \"commissionType\": \"<string>\",\n \"commissionAmount\": 123\n}"
response = http.request(request)
puts response.read_bodyVendors
Create Vendor
Register a new vendor in your shop
POST
/
v1
/
vendors
Create Vendor
curl --request POST \
--url https://staging-api.puppetvendors.com/v1/vendors \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"vendorName": "<string>",
"commissionType": "<string>",
"commissionAmount": 123
}
'import requests
url = "https://staging-api.puppetvendors.com/v1/vendors"
payload = {
"vendorName": "<string>",
"commissionType": "<string>",
"commissionAmount": 123
}
headers = {
"x-access-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({vendorName: '<string>', commissionType: '<string>', commissionAmount: 123})
};
fetch('https://staging-api.puppetvendors.com/v1/vendors', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging-api.puppetvendors.com/v1/vendors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'vendorName' => '<string>',
'commissionType' => '<string>',
'commissionAmount' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging-api.puppetvendors.com/v1/vendors"
payload := strings.NewReader("{\n \"vendorName\": \"<string>\",\n \"commissionType\": \"<string>\",\n \"commissionAmount\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging-api.puppetvendors.com/v1/vendors")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"vendorName\": \"<string>\",\n \"commissionType\": \"<string>\",\n \"commissionAmount\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-api.puppetvendors.com/v1/vendors")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"vendorName\": \"<string>\",\n \"commissionType\": \"<string>\",\n \"commissionAmount\": 123\n}"
response = http.request(request)
puts response.read_bodyOverview
Creates a new vendor with the specified commission configuration. The vendor name is stored in lowercase and must be unique within your shop.Use Cases
- Automate vendor onboarding from a registration form or CRM
- Bulk-create vendors by scripting multiple API calls
- Sync vendors from an external marketplace or ERP system
Request Body
Name of the vendor. Will be converted to lowercase. Must be unique per shop.
Commission model:
"percentage" or "flat".Commission value. For percentage type, this is the percentage (e.g.
10 for 10%). For flat type, this is the fixed amount per item.Response
200
{
"message": "Vendor created successfully.",
"vendor": {
"_id": "6157faecbebcf01bf49097d9",
"vendorName": "acme supplies",
"commissionType": "percentage",
"commissionAmount": 10,
"shopId": "...",
"createdAt": "2024-01-15T08:00:00.000Z"
}
}
Error: Duplicate Vendor
409
{
"error": "A vendor with this name already exists.",
"vendorName": "acme supplies"
}
Example
curl -X POST https://api.puppetvendors.com/v1/vendors \
-H "Content-Type: application/json" \
-H "x-access-token: YOUR_JWT_TOKEN" \
-d '{
"vendorName": "Acme Supplies",
"commissionType": "percentage",
"commissionAmount": 10
}'
Was this page helpful?
⌘I