AIESEC developer guides
[Link]/developer-guides
Using the AIESEC GraphQL API
Last updated: 22nd April 2024
What is an API?
As API is a way for two services to AIESEC’s GIS also provides an API to access information present on our
communicate over the internet. systems
Usual behaviour is where a client “requests”
request
to manipulate (create, read, update or delete)
GIS API
business
a resource on a different system.
logic
APIs are designed to be stateless, meaning client response
each request from client to server must
contain all the information needed to AIESEC GIS
understand and complete the request.
The API takes care of authentication and authorization and
handles all business related login so that the user would
An API is like a waiter in a restaurant: it takes your order
(request) to the kitchen (system) and brings back what not have to worry about it.
you asked for (response).
What is GraphQL
GraphQL is a query language for APIs that allows clients
to request exactly the data they need from a server.
Unlike REST, where endpoints return fixed data
structures, GraphQL lets clients the structure of the
data required. The server then responds with precisely
the data requested, no more, no less.
This flexibility can reduce the amount of data
transferred over the network and improve efficiency.
GraphQL also enables clients to request data from
multiple resources in a single query, which can simplify
the process of fetching complex data structures.
[Link]
Learn more about GraphQL
Step 1: Obtain an access token
1. Create a developer application and
generate access tokens
Guide
or
1. Use the quick and dirty method
Only use this if you want a quick access token for
testing purposes
Step 1: Obtain an access token (quick and dirty)
1. Login to EXPA on a Google Chrome
browser on Desktop.
2. Open the developer tools window
(CTRL + Shift + I) or (Right click → inspect)
3. Navigate to the Application tab.
4. Open the Local Storage menu item
under the Storage section in the left
menu
5. Click on [Link]
6. Find the corresponding value for the key,
aiesec_token
Note:
An access token obtained using this method is
temporary and will expire after 2 hours
Step 2: Download a GraphQL client
recommended by AIESEC International
the rest of this guide will follow the usage of
Altair GraphQL Client
Step 3: Set the GraphQL endpoint
1. Set the endpoint URL as
[Link]
Step 4: Set the Authorization Header
1. Set the Header value for
Authorization as the access token
you obtained.
Setting Headers
Step 5: Load Docs
1. Click on the icon to load the docs
for the AIESEC GIS API
Types of GraphQL operations
There are two main types of operations you can perform with GraphQL
Queries Mutations Queries read data
Queries are used to fetch or read data. Mutations, on the other hand, are
They are designed to request and intended for any operation that causes a Mutations create, update or delete data
retrieve information from the server in change or modification to the data on
a safe way that does not change or the server, such as creating, updating, or
modify the data on the server. deleting records.
‘
Queries in GraphQL are executed in Unlike queries, mutations are executed
parallel, meaning that if you include serially by the server. This ensures that
multiple queries in a single request, if a request includes multiple mutations,
GraphQL attempts to resolve them they are processed one after the other
simultaneously, optimizing data fetching in the exact order they were specified,
performance. which helps in maintaining the integrity
of operations that depend on each
other.
Step 6: Explore Docs
1. Explore the documentation to look for
the query/mutation you need.
2. This is usually a process of trial and error
in order to find the exact operation you
need
GIS API Schema
*as of 22nd April 2024
Step 7: Try out operations
1. Once you find the query/mutation you
need, try it out.
Click this to execute your query
write your query here
the response will
appear here
Step 8: Implement the query in your code
import { ApolloClient, InMemoryCache } from "@apollo/client"; This is a sample Javascript code to
async function getPersonName(personId) { retrieve a person’s (EP or member)
const client = new ApolloClient({
uri: "[Link]
name using the Apollo GraphQL
cache: new InMemoryCache(), client for JS
headers: {
authorization: “<access_token>”,
},
});
const query = `
{
person(id: "3204171") {
first_name
write your query here
last_name
}
}
`;
the response will
const data = await [Link]({
query: query, appear here
});
const name = `The person's name is ${[Link].first_name} ${[Link].last_name}`;
return name;
}
Additional Resources
AIESEC developer guides
[Link]/developer-guides