cURL
curl --request POST \
--url http://localhost:3000/connect/v1/catalogs/premiums/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"id": "<string>",
"options": [
{
"name": "<string>",
"amount": 123,
"id": "<string>",
"is_active": true,
"creator": "<string>",
"updater": "<string>"
}
],
"amount": 123,
"included": true,
"dependant_on_card": true,
"is_active": true,
"creator": "<string>",
"updater": "<string>",
"owner": "<string>"
}
'import requests
url = "http://localhost:3000/connect/v1/catalogs/premiums/"
payload = {
"name": "<string>",
"id": "<string>",
"options": [
{
"name": "<string>",
"amount": 123,
"id": "<string>",
"is_active": True,
"creator": "<string>",
"updater": "<string>"
}
],
"amount": 123,
"included": True,
"dependant_on_card": True,
"is_active": True,
"creator": "<string>",
"updater": "<string>",
"owner": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
id: '<string>',
options: [
{
name: '<string>',
amount: 123,
id: '<string>',
is_active: true,
creator: '<string>',
updater: '<string>'
}
],
amount: 123,
included: true,
dependant_on_card: true,
is_active: true,
creator: '<string>',
updater: '<string>',
owner: '<string>'
})
};
fetch('http://localhost:3000/connect/v1/catalogs/premiums/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/connect/v1/catalogs/premiums/",
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([
'name' => '<string>',
'id' => '<string>',
'options' => [
[
'name' => '<string>',
'amount' => 123,
'id' => '<string>',
'is_active' => true,
'creator' => '<string>',
'updater' => '<string>'
]
],
'amount' => 123,
'included' => true,
'dependant_on_card' => true,
'is_active' => true,
'creator' => '<string>',
'updater' => '<string>',
'owner' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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 := "http://localhost:3000/connect/v1/catalogs/premiums/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"options\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"id\": \"<string>\",\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\"\n }\n ],\n \"amount\": 123,\n \"included\": true,\n \"dependant_on_card\": true,\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\",\n \"owner\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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("http://localhost:3000/connect/v1/catalogs/premiums/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"options\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"id\": \"<string>\",\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\"\n }\n ],\n \"amount\": 123,\n \"included\": true,\n \"dependant_on_card\": true,\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\",\n \"owner\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/connect/v1/catalogs/premiums/")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"options\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"id\": \"<string>\",\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\"\n }\n ],\n \"amount\": 123,\n \"included\": true,\n \"dependant_on_card\": true,\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\",\n \"owner\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"id": "<string>",
"options": [
{
"name": "<string>",
"amount": 123,
"id": "<string>",
"updated_on": "2023-11-07T05:31:56Z",
"created_on": "2023-11-07T05:31:56Z",
"is_active": true,
"creator": "<string>",
"updater": "<string>"
}
],
"updated_on": "2023-11-07T05:31:56Z",
"created_on": "2023-11-07T05:31:56Z",
"amount": 123,
"included": true,
"dependant_on_card": true,
"is_active": true,
"creator": "<string>",
"updater": "<string>",
"owner": "<string>"
}Catalogs
Create Premium Endpoint
Create Premium endpoint allows you to create a new premium by making a POST request. Provide the required information in the request body, such as premium options, owner, name, type, amount, and other relevant details.
POST
/
catalogs
/
premiums
/
cURL
curl --request POST \
--url http://localhost:3000/connect/v1/catalogs/premiums/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"id": "<string>",
"options": [
{
"name": "<string>",
"amount": 123,
"id": "<string>",
"is_active": true,
"creator": "<string>",
"updater": "<string>"
}
],
"amount": 123,
"included": true,
"dependant_on_card": true,
"is_active": true,
"creator": "<string>",
"updater": "<string>",
"owner": "<string>"
}
'import requests
url = "http://localhost:3000/connect/v1/catalogs/premiums/"
payload = {
"name": "<string>",
"id": "<string>",
"options": [
{
"name": "<string>",
"amount": 123,
"id": "<string>",
"is_active": True,
"creator": "<string>",
"updater": "<string>"
}
],
"amount": 123,
"included": True,
"dependant_on_card": True,
"is_active": True,
"creator": "<string>",
"updater": "<string>",
"owner": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
id: '<string>',
options: [
{
name: '<string>',
amount: 123,
id: '<string>',
is_active: true,
creator: '<string>',
updater: '<string>'
}
],
amount: 123,
included: true,
dependant_on_card: true,
is_active: true,
creator: '<string>',
updater: '<string>',
owner: '<string>'
})
};
fetch('http://localhost:3000/connect/v1/catalogs/premiums/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/connect/v1/catalogs/premiums/",
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([
'name' => '<string>',
'id' => '<string>',
'options' => [
[
'name' => '<string>',
'amount' => 123,
'id' => '<string>',
'is_active' => true,
'creator' => '<string>',
'updater' => '<string>'
]
],
'amount' => 123,
'included' => true,
'dependant_on_card' => true,
'is_active' => true,
'creator' => '<string>',
'updater' => '<string>',
'owner' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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 := "http://localhost:3000/connect/v1/catalogs/premiums/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"options\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"id\": \"<string>\",\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\"\n }\n ],\n \"amount\": 123,\n \"included\": true,\n \"dependant_on_card\": true,\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\",\n \"owner\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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("http://localhost:3000/connect/v1/catalogs/premiums/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"options\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"id\": \"<string>\",\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\"\n }\n ],\n \"amount\": 123,\n \"included\": true,\n \"dependant_on_card\": true,\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\",\n \"owner\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/connect/v1/catalogs/premiums/")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"options\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"id\": \"<string>\",\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\"\n }\n ],\n \"amount\": 123,\n \"included\": true,\n \"dependant_on_card\": true,\n \"is_active\": true,\n \"creator\": \"<string>\",\n \"updater\": \"<string>\",\n \"owner\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"id": "<string>",
"options": [
{
"name": "<string>",
"amount": 123,
"id": "<string>",
"updated_on": "2023-11-07T05:31:56Z",
"created_on": "2023-11-07T05:31:56Z",
"is_active": true,
"creator": "<string>",
"updater": "<string>"
}
],
"updated_on": "2023-11-07T05:31:56Z",
"created_on": "2023-11-07T05:31:56Z",
"amount": 123,
"included": true,
"dependant_on_card": true,
"is_active": true,
"creator": "<string>",
"updater": "<string>",
"owner": "<string>"
}Authorizations
Body
application/json
Required string length:
1 - 100Show child attributes
Show child attributes
Available options:
PAYOUT, TRANSACTION Available options:
PER_TRANSACTION, PER_KG, PER_UNIT_CURRENCY, PER_FARMER Available options:
BUY, SELL Available options:
NORMAL, MANUAL, OPTIONS Response
201 - application/json
Required string length:
1 - 100Show child attributes
Show child attributes
Available options:
PAYOUT, TRANSACTION Available options:
PER_TRANSACTION, PER_KG, PER_UNIT_CURRENCY, PER_FARMER Available options:
BUY, SELL Available options:
NORMAL, MANUAL, OPTIONS ⌘I
