Get #GAIA ID from #Gmail using #AvatarAPI
In this blog post, we will explore how to retrieve a user’s name, profile picture, and GAIA ID from an email address using the AvatarAPI.
Introduction to AvatarAPI
AvatarAPI is a powerful tool that allows developers to fetch user information from various providers. In this example, we will focus on retrieving data from Google, but it’s important to note that AvatarAPI supports multiple providers.
Making a Request to AvatarAPI
To get started, you need to make a POST request to the AvatarAPI endpoint with the necessary parameters. Here’s a step-by-step guide:
Step 1: Endpoint and Parameters
- Endpoint:
https://avatarapi.com/v2/api.aspx - Parameters:
username: Your AvatarAPI username (e.g.,demo)password: Your AvatarAPI password (e.g.,demo___)provider: The provider from which to fetch data (e.g.,Google)email: The email address of the user (e.g.,jenny.jones@gmail.com)
Step 2: Example Request
Here’s an example of how you can structure your request:
Copy{
"username": "demo",
"password": "demo___",
"provider": "Google",
"email": "jenny.jones@gmail.com"
}
Step 3: Sending the Request
You can use tools like Postman or write a simple script in your preferred programming language to send the POST request. Below is an example using Python with the requests library:
Copyimport requests
url = "https://avatarapi.com/v2/api.aspx"
data = {
"username": "demo",
"password": "demo___",
"provider": "Google",
"email": "jenny.jones@gmail.com"
}
response = requests.post(url, json=data)
print(response.json())
Step 4: Handling the Response
If the request is successful, you will receive a JSON response containing the user’s information. Here’s an example response:
Copy{
"Name": "Jenny Jones",
"Image": "https://lh3.googleusercontent.com/a-/ALV-UjVPreEBCPw4TstEZLnavq22uceFSCS3-KjAdHgnmyUfSA9hMKk",
"Valid": true,
"City": "",
"Country": "",
"IsDefault": true,
"Success": true,
"RawData": "108545052157874609391",
"Source": {
"Name": "Google"
}
}
Understanding the Response
- Name: The full name of the user.
- Image: The URL of the user’s profile picture.
- Valid: Indicates whether the email address is valid.
- City and Country: Location information (if available).
- IsDefault: Indicates if the returned data is the default for the provider.
- Success: Indicates whether the request was successful.
- RawData: The GAIA ID, which is a unique identifier for the user.
- Source: The provider from which the data was fetched.
Other Providers
While this example focuses on Google, AvatarAPI supports other providers as well. You can explore the AvatarAPI documentation to learn more about the available providers and their specific requirements.
Conclusion
Using AvatarAPI to retrieve user information from an email address is a straightforward process. By sending a POST request with the necessary parameters, you can easily access valuable user data such as name, profile picture, and GAIA ID. This information can be instrumental in enhancing user experiences and integrating with various applications.
Stay tuned for more insights on leveraging APIs for efficient data retrieval!