Skill Level: 
Advanced

This API endpoint will return a list of all the available audiences.

Available Methods

Read

GET http://events.unl.edu/api/v2/audiences/

This endpoint is for getting a list of all the available audiences.

HTTP Method


GET

Authentication Requirements


None

Request Data


None

Response Data


  • Status number
    Status code for the request.
  • Message string
    Status message for the request.
  • Data object | null
    The requested data or null on error.
    • Audiences Array of Audience Objects
      A list of all the audiences that the system has available.
      • ID String
        ID of the audience record.
      • Name String
        Name of the audience record.

Example Code


Javascript
async function eventsAPI() {
    const response = await fetch('https://events.unl.edu/api/v2/audiences/');
    if (response.ok) {
        const response_json = await response.json();
        console.log(response_json.data);
    }
}
CURL
curl -X GET 'https://events.unl.edu/api/v2/audiences/'
PHP
function eventsAPI() {
    $url = 'https://events.unl.edu/api/v2/audiences/';

    // Make an HTTP GET request using file_get_contents
    $response = file_get_contents($url);

    if ($response !== false) {
        // Decode the JSON response
        $responseData = json_decode($response, true);

        // Check if JSON decoding was successful
        if ($responseData !== null) {
            // Access the 'data' field in the response JSON
            var_dump($responseData);
        } else {
            echo 'JSON decoding error';
        }
    } else {
        echo 'Error fetching data';
    }
}
Contributed By: 
DXG