This guide outlines the steps required to fetch profile data from TheGrid by utilizing the profile ID. The process involves two main steps: first, obtaining the profile ID through a search query, and second, using the profile ID to retrieve the profile information.
Step 1: Obtaining the Profile ID
To retrieve a profile ID, you must perform a search request to TheGrid's search endpoint.
Endpoint
https://search.thegrid.id/
Request Format
Initiate a GET request to the endpoint with a query parameter q representing the keyword of the profile you are searching for.
Example:
https://search.thegrid.id/?q=bitcoin
In this example, q=bitcoin specifies that we are searching for profiles related to Bitcoin.
Response
The response will be in JSON format, containing a list of profiles that match the search criteria. Each profile includes an id, name, logo, description, and url. From this response, select the id of the profile you wish to retrieve.
Example Response for q=bitcoin:
{
"body": {
"search_request": "bitcoin",
"search_result": {
"profiles": [
{
"id": "ID-1",
"name": "Bitcoin",
"logo": "",
"description": "Bitcoin offers a way to conduct transactions without reliance on centralized entities. Transactions are verified by network nodes through cryptography and recorded in a public dispersed ledger called a blockchain. Bitcoin was invented in 2008 by an unknown person or group of people using the name Satoshi Nakamoto.",
"url": ""
},
{
"id": "ID-17",
"name": "DogeCoin",
"logo": "",
"description": "Dogecoin (DOGE) is an open-source, peer-to-peer cryptocurrency that was made as a parody of the crypto market following the establishment of Bitcoin. It was originally created as a light-hearted joke for crypto enthusiasts, but it quickly exploded to be one of the leading cryptocurrencies in use today.",
"url": "dogecoin.com"
}
]
}
},
"statusCode": 200
}
In this example, the Bitcoin profile has an ID of ID-1.
Step 2: Fetching the Profile
After obtaining the profile ID using the method described in the previous sections, you can fetch detailed information about the profile by making a request to TheGrid's profile information endpoint.
Making the Request
To retrieve a single profile information, make a GET request to the following endpoint, replacing PROFILE_ID with the actual profile ID you obtained:
https://fetch.thegrid.id/?id=PROFILE_ID
Example Request
If you obtained ID-1 as the profile ID for Bitcoin, the request URL would be:
https://fetch.thegrid.id/?id=ID-1
Handling the Response
The response to this request will be in JSON format, providing detailed information about the profile, including but not limited to the profile's name, description, and any relevant URLs.
Retrieving Multiple Profiles
To fetch details for multiple profiles in a single request, you can use the ids parameter in your query string. This parameter accepts a comma-separated list of profile IDs. Spaces are allowed and will be handled by the API, but it's a good practice to format the request URL cleanly.
Making the Request
Specify the profile IDs you wish to retrieve, separated by commas, and append them to the query string as the value of the ids parameter.