curl --request POST \
--url https://api-alpha.fourvenues.com/resellers/swap \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api-alpha.fourvenues.com/resellers/swap"
payload = {}
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({})
};
fetch('https://api-alpha.fourvenues.com/resellers/swap', 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-alpha.fourvenues.com/resellers/swap",
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([
]),
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 := "https://api-alpha.fourvenues.com/resellers/swap"
payload := strings.NewReader("{}")
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("https://api-alpha.fourvenues.com/resellers/swap")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-alpha.fourvenues.com/resellers/swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"id": "abcdefghijk1234567890",
"barcode": "ABCD1235",
"pdf": "https://cdn.fourvenues.com/abcdefghijk1234567890-ABCD1235.pdf"
}Swap reseller ticket
Swaps a reseller’s ticket with a new one and provides a new barcode and PDF.
One ticket per request. ticket is a single object, not a list: there is no batch or multi-swap variant of this endpoint, and any field outside the documented ones answers 400. To transfer several tickets, call the endpoint once per barcode. Each call is independent, so a failure on one barcode leaves the others untouched.
One swap per ticket. The swap returns a new ticket that carries the resale on it, so calling swap again with that new barcode answers 200 with swappable: false and error: "RESELL_ALREADY_RESOLD". The same rule is what Validate reseller barcode reports up front.
A rule that blocks the resale answers 200 with swappable: false and no swap performed, except for an already scanned ticket or one whose holder name was already changed, which answer 400. Check swappable rather than the status code.
error | Meaning |
|---|---|
RESELL_NOT_ALLOWED | The ticket was already scanned, or its holder name was already changed. valid is false. |
RESELL_PENDING_NAME_CHANGE | A name change on the ticket is awaiting payment. |
RESELL_ALREADY_RESOLD | The ticket already came from a swap. A ticket can only be resold once. |
RESELL_NOT_SWAPPABLE | The ticket belongs to an organization your API key does not cover. |
When a ticket matches more than one rule, the first one in that order is the one reported.
curl --request POST \
--url https://api-alpha.fourvenues.com/resellers/swap \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api-alpha.fourvenues.com/resellers/swap"
payload = {}
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({})
};
fetch('https://api-alpha.fourvenues.com/resellers/swap', 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-alpha.fourvenues.com/resellers/swap",
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([
]),
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 := "https://api-alpha.fourvenues.com/resellers/swap"
payload := strings.NewReader("{}")
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("https://api-alpha.fourvenues.com/resellers/swap")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-alpha.fourvenues.com/resellers/swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"id": "abcdefghijk1234567890",
"barcode": "ABCD1235",
"pdf": "https://cdn.fourvenues.com/abcdefghijk1234567890-ABCD1235.pdf"
}Authorizations
Reseller API key, sent raw in the Authorization header: Authorization: rs_live_xxxxxxxxxxxxxxxx. Keys prefixed rs_test_ operate against the test environment. The same key serves v2 and the swap operations, and it only reaches the organizations Fourvenues authorized on it.
Body
Response
Swap performed, or refused by a resale rule
"abcdefghijk1234567890"
"ABCD1235"
"https://cdn.fourvenues.com/abcdefghijk1234567890-ABCD1235.pdf"
Only present when the swap was refused.
true
Only present when the swap was refused. Always false there.
false
Only present when the swap was refused. Names the rule that blocked it.
RESELL_PENDING_NAME_CHANGE, RESELL_ALREADY_RESOLD, RESELL_NOT_SWAPPABLE "RESELL_ALREADY_RESOLD"