Update a voucher
curl --request PUT \
--url https://api.spirii.com/vouchers/{id} \
--header 'Content-Type: application/json' \
--data '
{
"groupId": 113,
"maxUsers": 3,
"expiresAt": "2022-01-20T08:08:24.878Z"
}
'import requests
url = "https://api.spirii.com/vouchers/{id}"
payload = {
"groupId": 113,
"maxUsers": 3,
"expiresAt": "2022-01-20T08:08:24.878Z"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({groupId: 113, maxUsers: 3, expiresAt: '2022-01-20T08:08:24.878Z'})
};
fetch('https://api.spirii.com/vouchers/{id}', 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://api.spirii.com/vouchers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'groupId' => 113,
'maxUsers' => 3,
'expiresAt' => '2022-01-20T08:08:24.878Z'
]),
CURLOPT_HTTPHEADER => [
"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 := "https://api.spirii.com/vouchers/{id}"
payload := strings.NewReader("{\n \"groupId\": 113,\n \"maxUsers\": 3,\n \"expiresAt\": \"2022-01-20T08:08:24.878Z\"\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(string(body))
}HttpResponse<String> response = Unirest.put("https://api.spirii.com/vouchers/{id}")
.header("Content-Type", "application/json")
.body("{\n \"groupId\": 113,\n \"maxUsers\": 3,\n \"expiresAt\": \"2022-01-20T08:08:24.878Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spirii.com/vouchers/{id}")
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 \"groupId\": 113,\n \"maxUsers\": 3,\n \"expiresAt\": \"2022-01-20T08:08:24.878Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": 12710,
"groupId": 778,
"code": "123hjbo6",
"maxUsers": null,
"createdAt": "2022-06-10T13:54:04.000Z",
"updatedAt": "2022-10-03T09:57:04.000Z",
"expiresAt": "2022-10-03T11:57:04.000Z",
"locations": [
{
"id": 1209,
"name": "Gentofte Hospital",
"streetAddress": "Ledreborg allé 36",
"zipCode": "2820",
"city": "Gentofte"
},
{
"id": 1330,
"name": "Hillerød Hospital",
"streetAddress": "Dyrehavevej 48",
"zipCode": "3400",
"city": "Hillerød"
}
],
"group": {
"id": 778,
"name": "4545",
"perKwh": 3,
"currency": "DKK",
"isSpotPriceBased": false,
"spotPriceMargin": 26,
"spotPriceMarginPct": 10,
"spotPriceMinimum": 24,
"createdAt": "2022-06-08T15:52:43.000Z",
"updatedAt": "2022-11-07T04:56:18.000Z",
"voucherCount": 0
}
}{
"error": {
"message": "Querystring parameter `id` is not allowed",
"statusCode": 400,
"code": "QueryParamNotAllowed"
}
}{
"error": {
"message": "Something went wroing, try again later",
"statusCode": 500
}
}Update a voucher
PUT
/
vouchers
/
{id}
Update a voucher
curl --request PUT \
--url https://api.spirii.com/vouchers/{id} \
--header 'Content-Type: application/json' \
--data '
{
"groupId": 113,
"maxUsers": 3,
"expiresAt": "2022-01-20T08:08:24.878Z"
}
'import requests
url = "https://api.spirii.com/vouchers/{id}"
payload = {
"groupId": 113,
"maxUsers": 3,
"expiresAt": "2022-01-20T08:08:24.878Z"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({groupId: 113, maxUsers: 3, expiresAt: '2022-01-20T08:08:24.878Z'})
};
fetch('https://api.spirii.com/vouchers/{id}', 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://api.spirii.com/vouchers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'groupId' => 113,
'maxUsers' => 3,
'expiresAt' => '2022-01-20T08:08:24.878Z'
]),
CURLOPT_HTTPHEADER => [
"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 := "https://api.spirii.com/vouchers/{id}"
payload := strings.NewReader("{\n \"groupId\": 113,\n \"maxUsers\": 3,\n \"expiresAt\": \"2022-01-20T08:08:24.878Z\"\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(string(body))
}HttpResponse<String> response = Unirest.put("https://api.spirii.com/vouchers/{id}")
.header("Content-Type", "application/json")
.body("{\n \"groupId\": 113,\n \"maxUsers\": 3,\n \"expiresAt\": \"2022-01-20T08:08:24.878Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spirii.com/vouchers/{id}")
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 \"groupId\": 113,\n \"maxUsers\": 3,\n \"expiresAt\": \"2022-01-20T08:08:24.878Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": 12710,
"groupId": 778,
"code": "123hjbo6",
"maxUsers": null,
"createdAt": "2022-06-10T13:54:04.000Z",
"updatedAt": "2022-10-03T09:57:04.000Z",
"expiresAt": "2022-10-03T11:57:04.000Z",
"locations": [
{
"id": 1209,
"name": "Gentofte Hospital",
"streetAddress": "Ledreborg allé 36",
"zipCode": "2820",
"city": "Gentofte"
},
{
"id": 1330,
"name": "Hillerød Hospital",
"streetAddress": "Dyrehavevej 48",
"zipCode": "3400",
"city": "Hillerød"
}
],
"group": {
"id": 778,
"name": "4545",
"perKwh": 3,
"currency": "DKK",
"isSpotPriceBased": false,
"spotPriceMargin": 26,
"spotPriceMarginPct": 10,
"spotPriceMinimum": 24,
"createdAt": "2022-06-08T15:52:43.000Z",
"updatedAt": "2022-11-07T04:56:18.000Z",
"voucherCount": 0
}
}{
"error": {
"message": "Querystring parameter `id` is not allowed",
"statusCode": 400,
"code": "QueryParamNotAllowed"
}
}{
"error": {
"message": "Something went wroing, try again later",
"statusCode": 500
}
}Path Parameters
Voucher Id
Body
application/json
Voucher update data
Response
Voucher list
id
Example:
1
Example:
5
Example:
"code123"
Example:
5
Updated date
Example:
"2021-04-20T14:38:20.000Z"
pricing currency
Example:
"DKK"
Updated date
Example:
"2021-04-20T14:38:20.000Z"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?