Fetch the Record Based on Query
Introduction
This API allows you to fetch the record based on the query. Please read the following instructions carefully so you can make successful requests.
Base URL
The base URL for all API requests is:
Domain | URL |
---|---|
api.odin.io | api.odin.io/v1 |
The endpoint for host search is:
/hosts/search
Authentication
All requests to this API must include an authentication token in the headers. Use the following header for authentication:
X-API-Key: V8qb6HJIRKY7tVH0sou90I7YX3pCuqLQfRLmUzxpQbY=
Request Parameters
The API requires the following request parameter to be included in the request body:
To search for host count based on specific criteria, send a POST request to the following URL:
https://api.odin.io/v1/hosts/search/
Include the following parameters in the request body:
Name | Description |
---|---|
limit | Specifies the maximum number of hosts to return in the response. The default value is 10 if not provided. |
query | Specifies the search query to filter hosts. The query should be provided in the following format: <field>:<value>. In this case, the query is based on the services.port field and the desired value is 80. |
Example Request
{
"limit": 9,
"query": "services.port:\"80\""
}
CURL
curl --location 'https://api.odin.io/v1/hosts/search/' \
--header 'X-API-Key: V8qb6HJIRKY7tVH0sou90I7YX3pCuqLQfRLmUzxpQbY=' \
--header 'Content-Type: application/json' \
--data '{
"limit": 9,
"query": "services.port:\"80\""
}'
This cURL command is structured to perform an HTTP POST request to the https://api.odin.io/v1/hosts/search/ endpoint. Let's break down the components:
location: Instructs cURL to follow HTTP redirects if the response indicates a redirect.
header 'X-API-Key: V8qb6HJIRKY7tVH0sou90I7YX3pCuqLQfRLmUzxpQbY=': Sets the header for the API key. The key provided here is V8qb6HJIRKY7tVH0sou90I7YX3pCuqLQfRLmUzxpQbY='.
header 'Content-Type: application/json': Specifies that the content sent in the request body is in JSON format.
data '{ "limit": 9, "query": "services.port:\"80\"" }': Sends a JSON payload in the request body. The payload includes:
"limit": 9: Indicates that the response should include a maximum of 9 results.
"query": "services.port:\"80\"": Specifies the query parameter for searching hosts. It's looking for hosts where the port for services is specifically '80'.
Response Parameters
The API response will contain the following parameters:
Example Response
{
"success": true,
"pagination": {
"start": null,
"last": [
1,
1688639288692
],
"limit": 9,
"total": 64413010
},
"data": [{
"asn": {
"country_code": null,
"number": "AS14909",
"organization": "JD-02"
},
"asn_updated_at": "0001-01-01T00:00:00Z",
"domains": null,
"hostnames": [{
"last_updated_at": "2023-07-06T10:28:11.695578083Z",
"name": "ec2-52-64-233-185.ap-southeast-2.compute.amazonaws.com"
}],
"ip": "8.8.8.8",
"is_ipv4": true,
"is_ipv6": false,
"last_updated_at": "2023-07-06T10:28:11.69574756Z",
"location": {
"city": "XYZ",
"continent": "ABC",
"coordinates": {
"latitude": "-33.8715",
"longitude": "151.2006"
},
"country_code": "AB",
"country_name": "XYZ",
"geo_point": "-33.8715, 151.2006",
"locale_code": "en",
"network": "8.8.8.8/12",
"postal_code": "2000"
},
"location_updated_at": "2023-07-06T05:46:44Z",
"scan_id": 1683276692,
"services": [{
"_meta": {
"category": "",
"desc": "",
"name": "http",
"tags": null
},
"extra_info": "",
"last_updated_at": "2023-05-06T06:20:56.004Z",
"modules": {
"http": {
"content_length": 564,
"headers": {
"connection": [
"keep-alive"
],
"content_length": [
"564"
],
"content_type": [
"text/html"
],
"date": [
"Sat, 06 May 2023 12:10:48 GMT"
],
"server": [
"awselb/2.0"
]
},
"protocol": "HTTP/1.1",
"redirects": [{
"content_length": 134,
"location": "https://8.8.8.8:443/",
"status_code": 301,
"status_line": "301 Moved Permanently"
}],
"status_code": 503,
"transfer_encoding": null
}
},
"name": "http",
"port": 80,
"product": "awselb/2.0",
"protocol": "tcp",
"softwares": [],
"tunnel": "",
"version": ""
}],
"services_hash": "f18c9708017e2851cbedab20dafa98b14e59e866da4e41f811431a1627fb1c44",
"tags": [{
"last_updated_at": "2023-07-06T10:27:54Z",
"name": "is_cdn",
"pretty_name": "CDN",
"value": false
},
{
"last_updated_at": "2023-07-06T05:46:44Z",
"name": "is_anonymous_proxy",
"pretty_name": "Anonymous Proxy",
"value": false
},
{
"last_updated_at": "2023-07-06T05:46:44Z",
"name": "is_satellite_provider",
"pretty_name": "Satellite Provider",
"value": false
}
],
"whois": {
"_encoding": {
"raw": "BASE28"
},
"descr": "Jd EC2 SYD prefix",
"network": "52.64.196.0/17",
"organization": "Amazon EC2 SYD prefix",
"raw": null
},
"whois_updated_at": "2023-05-01T14:10:18Z"
}]
}
Success | A boolean value indicating the success status of the API request. |
Pagination | An object containing pagination information for the search results.
|
Data | An array containing the host information. |
asn | An object representing the Autonomous System Number (ASN) information for the host.
|
hostnames | An array of hostnames associated with the host.
|
Location | An object representing the geographical location information of the host.
|
Services | An array of services running on the host. |
meta | Meta information about the service.
|
tags | Contains an array of objects representing tags associated with the entity.
|
whois | Contains details about the encoding used for WHOIS data.
|
whois_updated_at | The timestamp when the WHOIS information was last updated. |