API Integration
Our IP Management API gives you read-only access to your service infrastructure. With just a few GraphQL queries, you can fetch detailed information about IP addresses, their ranges, and the services they’re associated with.
This guide will help you integrate our API into your systems to query IP-related data with precision and speed.
Before You Start
Before you begin, make sure you have the following:
-
Basic GraphQL Knowledge: The API uses GraphQL, so familiarity with queries and schema-based responses will be helpful.
-
Access to the API Endpoint: Ensure your system can make HTTP requests to our GraphQL endpoint.
-
API Key: Authentication is required for every request to the Travelgate GraphQL API. An API Key must be included in the HTTP Authorization request header to authenticate the user agent with the server. You can find your list of API Keys (encrypted) and create new ones on the Travelgate website in API Keys.
Authorization: ApiKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
General Information
-
API Endpoint:
https://api.travelgate.com
-
Access Type: Read-only (no mutations supported)
-
Primary Scope: Fetch IP addresses, ranges, and associated service metadata
Query: Fetch All Services
Retrieve all available services with optional details on associated IP addresses and their statuses.
Query Example:
{
infraestructure {
allServices {
id
name
description
createdAt
ipAddresses {
ipAddress
rangeStart
rangeEnd
status
}
}
}
}
Response Example:
{
"data": {
"infraestructure": {
"allServices": [
{
"id": "1",
"name": "ChannelX",
"description": "IP addresses for ChannelX services",
"createdAt": "2024-10-10T10:15:00",
"ipAddresses": [
{
"ipAddress": "13.94.250.159/32",
"rangeStart": "13.94.250.159",
"rangeEnd": "13.94.250.159",
"status": "active"
}
]
}
]
}
}
}
2. Fetch All IP Addresses
Retrieve all IP addresses or ranges with associated services and their statuses.
Query Example:
{
infraestructure {
allIpAddresses {
ipAddress
rangeStart
rangeEnd
services {
id
name
description
status
}
}
}
}
Response Example:
{
"data": {
"infraestructure": {
"allIpAddresses": [
{
"ipAddress": "192.168.1.1/32",
"rangeStart": "192.168.1.1",
"rangeEnd": "192.168.1.1",
"services": [
{
"id": "1",
"name": "ChannelX",
"description": "IP addresses for ChannelX services",
"status": "active"
}
]
}
]
}
}
}
3. Fetch a Specific Service by ID
Retrieve detailed information about a specific service and its associated IPs.
Query Example:
{
infraestructure {
serviceByID(id: "2") {
id
name
description
createdAt
ipAddresses {
ipAddress
rangeStart
rangeEnd
status
}
}
}
}
Response Example:
{
"data": {
"infraestructure": {
"serviceByID": {
"id": "1",
"name": "ChannelX",
"description": "IP addresses for ChannelX services",
"createdAt": "2024-10-10T10:15:00",
"ipAddresses": [
{
"ipAddress": "192.168.1.1/32",
"rangeStart": "192.168.1.1",
"rangeEnd": "192.168.1.1",
"status": "active",
}
]
}
}
}
}
4. Fetch IP Address by Specific Address
Fetch details of a specific IP address or check if an IP falls within a defined range.
Query Example:
{
infraestructure {
ipByAddress(address: "52.148.208.57") {
ipAddress
rangeStart
rangeEnd
services {
id
name
description
status
}
}
}
}
Response Example:
{
"data": {
"infraestructure": {
"ipByAddress": {
"ipAddress": "52.148.208.57/32",
"rangeStart": "52.148.208.57",
"rangeEnd": "52.148.208.57",
"services": [
{
"id": "3",
"name": "Inventory Push",
"description": "Service Inventory Push",
"status": "active"
}
]
}
}
}
}
5. Fetch IP Address by Range
Query for an IP address by providing an IP within a range.
Query Example:
{
infraestructure {
ipByAddress(address: "216.59.61.160") {
ipAddress
rangeStart
rangeEnd
services {
id
name
description
status
}
}
}
}
Response Example:
{
"data": {
"infraestructure": {
"ipByAddress": {
"ipAddress": "216.59.61.160/27",
"rangeStart": "216.59.61.160",
"rangeEnd": "216.59.61.191",
"services": [
{
"id": "2",
"name": "Hotel Suppliers",
"description": "Service Hotel Suppliers",
"status": "active"
}
]
}
}
}
}
Error Handling
Invalid IP Address
If an invalid IP address is passed, the API will return an error message.
Example:
{
infraestructure {
ipByAddress(address: "999.999.999.999") {
ipAddress
}
}
}
Response Example:
{
"errors": [
{
"message": "'999.999.999.999' is not a valid IP address.",
"locations": [
{
"line": 2,
"column": 3
}
]
}
],
"data": null
}
Additional Details
-
IP Address Fields:
ipAddress
: Holds a single IP address (or null if it's a range).rangeStart
,rangeEnd
: Used to define the start and end of an IP range.status
: Indicates whether the IP isactive
orinactive
.
-
Service Fields:
id
: The unique identifier of the service.name
: The name of the service.description
: A brief description of the service.
Conclusion
This API allows querying both individual IPs and IP ranges, with detailed relationships to services. It ensures robust validation of inputs and provides detailed responses, including the status and timestamps of IP addresses.