Get All Events
Introduction
The Get All Events API provides a list of all events listed by the authenticated user.
Retrieve All Events
To retrieve all events, you need to send an HTTP POST request to the following endpoint:
Endpoint
https://api.paydexp.com/v1/events
Authorization
Users need to include basic authentication credentials in the request headers.
Code Examples
Below are code examples in different programming languages demonstrating how to retrieve all events using HTTP POST requests.
- Curl
- Go
- Nodejs
- Python
- PHP
curl --location --request POST 'https://api.paydexp.com/api/v1/events' \
--header 'Authorization: ••••••'
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.paydexp.com/api/v1/events"
method := "POST"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "••••••")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
const axios = require('axios');
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.paydexp.com/api/v1/events',
headers: {
'Authorization': '••••••'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
import requests
url = "https://api.paydexp.com/api/v1/events"
payload = {}
headers = {
'Authorization': '••••••'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.paydexp.com/api/v1/events');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization': '••••••'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
Example of a successful response
{
"success": true,
"data": [
{
"id": 79,
"image": "1711600982.jpg",
"image_path": "https://beta.paydexp.com",
"is_online": 0,
"is_public": 0,
"currency": "KES",
"slug": "music-party",
"name": "Music Party",
"venue": "Geco Cafe",
"start_date": "2024-06-11T00:00:00.000000Z",
"status": "completed",
"ticket_price_range": "KES 15.00 - KES 100.00",
"event_categories": "festivals paid physical all",
"images_path": "https://beta.paydexp.com/web/images/event-imgs/1711600982.jpg"
},
{
"id": 103,
"image": "449967481718086542.png",
"image_path": "https://beta.paydexp.com",
"is_online": 0,
"is_public": 0,
"currency": "KES",
"slug": "payments-edge-case",
"name": "Payments Edge Case",
"venue": "Mint",
"start_date": "2024-08-10T00:00:00.000000Z",
"status": "completed",
"ticket_price_range": "KES 15.00 - KES 200.00",
"event_categories": "business-and-professional paid physical all",
"images_path": "https://beta.paydexp.com/web/images/event-imgs/449967481718086542.png"
}
],
"message": "Events retrieved successfully."
}
Conclusion
The Get All Events API provides a list of all events listed by the authenticated user. You can use this API to retrieve event details such as event name, venue, start date, ticket price range, and more.