September 12, 2023 | 7 min read

What Is an API?

An API stands for Application Programming Interface. API is a set of rules defining how two applications can interact. It allows programs to communicate and share data while maintaining physical and logical separation, allowing both applications to exist and run independently. The applications communicate with each other even if they are written in different programming languages.

Events APIs

Event APIs

Event Eventact API has those main parts:

Accessing Eventact APIs: Obtaining a Token

To use the office, registration, or abstract APIs, you need a token.

To get a token, call the Login API of the "office" API.

Here's a step-by-step guide on how to get an API token:

Step 1: Prepare Your Credentials

Before you can request a token, ensure you have the following credentials ready (you will obtain them from Eventact):

Step 2: Make a POST Request

Now you can make a POST request to the Eventact API at this endpoint: https://api.eventact.com/api-v1/office/login/login, and include a JSON object like this:

{
   username: 'anna',
   password: '12345',
   companyname: 'company'
}

that has been "stringified" in the request body.

Here's an example of how you might define such a function in React:

function GetToken() {
    const fetchData = async () => {
        try {
            const requestData = {
                username: 'anna',
                password: '12345',
                companyname: 'New_company',
            };

            const response = await fetch('https://api.eventact.com/api-v1/office/login/login', {
                method: 'POST',
                headers: {
                'Content-Type': 'application/json',
                },
                body: JSON.stringify(requestData),
            });

            if (response.ok) {
                const data = await response.json();
            } else {
                console.error('Error fetching data');
            }
        } catch (error) {
            console.error('Error:', error);
        }
    };

    fetchData();
}

The response data will have the following structure:

{  
 "companyName": "New_company",
 "companyID": 555, 
 "key": "XdMZdjiEh10jsyFzS6uYRtDhJogYkqkSydJA", 
}

The "key" field in the response represents the token, which you can use for further requests. You can define it in your code as follows:

Let token=data.key

Step 3: Access Eventact's API for Event Information

Eventact offers a variety of APIs tailored to meet your specific requirements. To gain access to the complete list of available APIs and their detailed documentation, simply reach out to us with your request. You will be able to retrieve data by changing the IDs of agenda, hall, event, or other items in the API endpoint according to the documentation. Additionally, you can add query parameters after the "?" mark at the end of the endpoint in the format like ?fromDate={timestamp} to filter and customize the data you receive.

To accomplish this, you will need to make an HTTP GET request to the relevant Eventact API endpoint, which will resemble the following URL structure: "https://api.eventact.com/api-v1/agenda/${projectID}/agendas/list".

Here, replace projectID with the numeric identifier of the specific event you are interested in. Additionally, ensure that you include the required headers in your request, as demonstrated below:

headers: {
    'API-token': token
    }  

For your convenience, we provide a sample function named GetAgendasList that encapsulates this API request:

function GetAgendasList(projectID, token) {
    const apiUrl = `https://api.eventact.com/api-v1/agenda/${projectID}/agendas/list`;

    return fetch(apiUrl, {
        method: 'GET',
        headers: {
            'API-token': token,
        },
    })
        .then((response) => {
            if (!response.ok) {
                throw new Error('Network response was not ok');
            }
            return response.json();
    })
        .then((data) => {
            return data;
    })
        .catch((error) => {
            console.error('Fetch error:', error);
            throw error;
        });
}

The data you receive from this API request will be an array of objects, each representing an agenda item for the event. These objects will include the agenda name, type, duration, start and end times, language, and other relevant information. Once you obtain this data, you can seamlessly integrate it into your website or application to create a table or display event-related information as needed.

To learn more about Eventact APIs, please visit our website or contact us for a demo. We would be happy to help you get started.

Read more