Fetch the Record Count

Introduction

This API allows you to fetch the record count for HOST based on specific criteria. 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.ioapi.odin.io/v1

The endpoint for host search is:

/hosts/count/

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/count/

Include the following parameters in the request body:

Name Type Description
querystringA search query is used to filter the records. It uses the format field: value. In this case, it searches for hosts with a service running on port 80.

Example Request

{
    "query": "services.port:\"80\""
}

CURL

curl -X 'POST' \ 'https://api.odin.io/v1/hosts/count' \
-H 'accept: application/json' \
-H 'X-API-Key: V8qb6HJIRKY7tVH0sou90I7YX3pCuqLQfRLmUzxpQbY=' \
-H 'Content-Type: application/json' \
-d '{ "query": "services.port:\"80\"" }'
  • curl: The curl command makes HTTP requests from the command line.

  • -X 'POST': This specifies the HTTP method for the request; in this case, it's a POST request.

  • 'https://api.odin.io/v1/hosts/count': This is the URL of the API endpoint to which the request is being sent.

  • -H 'accept application/json': This sets the accept header to specify that the client accepts responses in JSON format.

  • -H 'X-API-Key': V8qb6HJIRKY7tVH0sou90I7YX3pCuqLQfRLmUzxpQbY=': This sets the X-API-Key header with the provided authentication token.

  • -H 'Content-Type: application/json': This sets the Content-Type header to specify that the request body is JSON.

  • -d '{ "query": "services.port:\"80\"" }': This is the request payload (data) that will be sent with the POST request. In this case, it's a JSON object with the "query" field set to "services.port:\"80\"". The backslashes are used to escape new lines and maintain the request payload in a single line.

When you execute this curl command, it will send a POST request to https://api.odin.io/v1/hosts/count with the provided headers and request payload. The API will process the request and respond with the result in JSON format, containing the record count for hosts with services running on port 80.

Response Parameters

The API response will contain the following parameters:

Example Repsonse

{
    "success": true,
    "data": {
        "count": 66383039,
    },
}
Success A boolean parameter indicating the success of the request. This will be true if the request is successful.
DataAn object containing the record count.
Count The number of records that match the provided query.

Overall, the response indicates that the API request was successful and provides the count of 66383039 as part of the response data.

Response Headers

The additional parameters in the API response header you provided are as follows:

  • "access-control-allow-credentials": A boolean value indicating whether the API supports including credentials (such as cookies, HTTP authentication, and client-side SSL certificates) in cross-origin requests. In this case, it is set to true, indicating that credentials are allowed.

  • "access-control-expose-headers": Specifies which headers are exposed to the browser in the response. In this case, it includes the "X-Auth-Token" header.

  • "cf-cache-status": Indicates the cache status of the response. In this case, it is set to "DYNAMIC," which means the response is not cached.

  • "cf-ray": A unique identifier generated by Cloudflare for the request. It can be used for troubleshooting purposes.

  • "content-length": The size of the response content in bytes. In this case, the response content is 42 bytes.

  • "content-type": Specifies the MIME type of the response content. In this case, it is set to "application/JSON," indicating that the response content is in JSON format.

  • "date": The date and time the response was generated in GMT format.

  • "nel": Network Error Logging (NEL) information. It provides details for network errors and monitoring.

  • "referrer-policy": Specifies the policy for sending the Referer header. In this case, it is set to "strict-origin-when-cross-origin," which means the Referer header will only be sent when the request is from a same-origin context.

  • "report-to": Specifies the endpoint to which error reports should be sent. It includes the URL for reporting errors related to Cloudflare.

  • "server": Indicates the server software or platform used to handle the request. In this case, it is set to "Cloudflare."

  • "strict-transport-security": Indicates the duration (in seconds) the browser should remember to access the site via HTTPS. It also specifies to include subdomains and preload the strict transport security list.

  • "vary": Indicates the request header fields used to determine the response cacheability. In this case, it includes the "Origin" header.

  • "x-content-type-options": Specifies the browser's handling of content type sniffing. In this case, it is set to "sniff," indicating that the browser should not perform MIME-type sniffing.

  • "x-server": Provides information about the server that handled the request. In this case, it is set to "Asgard."

  • "x-xss-protection": Specifies the browser's Cross-Site Scripting (XSS) protection mode. In this case, it is set to "1; mode=block," indicating that the browser should enable XSS protection.

Previous
API
ODIN logo
LinkedIn IconDiscord IconGitHub IconMedium IconX Icon