This API endpoint allows you read your own data.
Available Methods
Read
GET
http://events.unl.edu/api/v2/me/
This endpoint is for validating you are logged in and in the events system.
HTTP Method
GET
Authentication Requirements
You must add a header to the request with the header key being
Authentication
and the value being your API Token.
You can also pass along the cookies of the site you are on if you are on a UNL subdomain.
Request Data
None
Response Data
Example Code
async function eventsAPI() { const response = await fetch('https://events.unl.edu/api/v2/me/', { 'credentials': 'include' }); //const response = await fetch('https://events.unl.edu/api/v2/me/', { // headers: { // 'Authentication': MY_API_TOKEN, // }, //}); if (response.ok) { const response_json = await response.json(); console.log(response_json.data); } }
curl -X GET 'https://events.unl.edu/api/v2/me/' \ -H 'Authentication: MY_API_TOKEN'
function eventsAPI() { $apiToken = 'MY_API_TOKEN'; $url = 'https://events.unl.edu/api/v2/me/'; $headers = array( 'Authentication: ' . $apiToken, ); // Initialize cURL session $ch = curl_init(); // Set cURL options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // Execute cURL session and get the response $response = curl_exec($ch); // Check if cURL request was successful if ($response === false) { // Handle cURL error echo 'cURL Error: ' . curl_error($ch); } else { $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode === 200) { // Successful response $responseData = json_decode($response, true); var_dump($responseData); } else { // Error response echo 'API Error: ' . $response; } } // Close cURL session curl_close($ch); }
Read (Locations)
GET
http://events.unl.edu/api/v2/me/locations/
This endpoint is for getting your saved locations.
HTTP Method
GET
Authentication Requirements
You must add a header to the request with the header key being
Authentication
and the value being your API Token.
You can also pass along the cookies of the site you are on if you are on a UNL subdomain.
Request Data
None
Response Data
Example Code
async function eventsAPI() { const response = await fetch('https://events.unl.edu/api/v2/me/locations/', { 'credentials': 'include' }); //const response = await fetch('https://events.unl.edu/api/v2/me/locations/', { // headers: { // 'Authentication': MY_API_TOKEN, // }, //}); if (response.ok) { const response_json = await response.json(); console.log(response_json.data); } }
curl -X GET 'https://events.unl.edu/api/v2/me/locations/' \ -H 'Authentication: MY_API_TOKEN'
function eventsAPI() { $apiToken = 'MY_API_TOKEN'; $url = 'https://events.unl.edu/api/v2/me/locations/'; $headers = array( 'Authentication: ' . $apiToken, ); // Initialize cURL session $ch = curl_init(); // Set cURL options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // Execute cURL session and get the response $response = curl_exec($ch); // Check if cURL request was successful if ($response === false) { // Handle cURL error echo 'cURL Error: ' . curl_error($ch); } else { $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode === 200) { // Successful response $responseData = json_decode($response, true); var_dump($responseData); } else { // Error response echo 'API Error: ' . $response; } } // Close cURL session curl_close($ch); }
Read (Virtual Locations)
GET
http://events.unl.edu/api/v2/me/virtual-locations/
This endpoint is for getting your saved virtual locations.
HTTP Method
GET
Authentication Requirements
You must add a header to the request with the header key being
Authentication
and the value being your API Token.
You can also pass along the cookies of the site you are on if you are on a UNL subdomain.
Request Data
None
Response Data
Example Code
async function eventsAPI() { const response = await fetch('https://events.unl.edu/api/v2/me/virtual-locations/', { 'credentials': 'include' }); //const response = await fetch('https://events.unl.edu/api/v2/me/virtual-locations/', { // headers: { // 'Authentication': MY_API_TOKEN, // }, //}); if (response.ok) { const response_json = await response.json(); console.log(response_json.data); } }
curl -X GET 'https://events.unl.edu/api/v2/me/virtual-locations/' \ -H 'Authentication: MY_API_TOKEN'
function eventsAPI() { $apiToken = 'MY_API_TOKEN'; $url = 'https://events.unl.edu/api/v2/me/virtual-locations/'; $headers = array( 'Authentication: ' . $apiToken, ); // Initialize cURL session $ch = curl_init(); // Set cURL options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // Execute cURL session and get the response $response = curl_exec($ch); // Check if cURL request was successful if ($response === false) { // Handle cURL error echo 'cURL Error: ' . curl_error($ch); } else { $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode === 200) { // Successful response $responseData = json_decode($response, true); var_dump($responseData); } else { // Error response echo 'API Error: ' . $response; } } // Close cURL session curl_close($ch); }
- Printer-friendly version
- Log in to post comments