Gaming industry under DDoS attack. Get DDoS protection now. Start onboarding
  1. Home
  2. Blog
  3. Interacting with Gcore API Using JetBrains HTTP Client
Expert insights

Interacting with Gcore API Using JetBrains HTTP Client

  • June 20, 2023
  • 3 min read
Interacting with Gcore API Using JetBrains HTTP Client

Testing API requests is an essential aspect of developing and maintaining a RESTful API. Testing requests for your RESTful API is crucial for ensuring its functionality, reliability, performance, and adherence to specifications. It helps in identifying and addressing issues early in the development process, leading to a more stable and robust API that delivers the expected results to its consumers. In this blog, we’ll guide you through using the JetBrains HTTP client to interact with Gcore’s API, enhancing your development workflow through greater efficiency.

Why Use JetBrains HTTP Client?

If you’re looking for an efficient way to test your REST APIs or send HTTP requests, JetBrains HTTP client is an excellent option. The JetBrains HTTP client is an integrated tool available within JetBrains IDEs like IntelliJ IDEA, PyCharm, and WebStorm. It facilitates the testing, debugging, and analysis of RESTful APIs by allowing developers to create, execute, and inspect HTTP requests directly from their IDEs. With features like request creation, request history, response inspection, syntax highlighting, code snippet generation, variable substitution, test scripts, and authentication support, the JetBrains HTTP client provides a convenient and efficient way for developers to interact with APIs during development and testing. It enhances the development workflow by eliminating the need for external tools and ensuring seamless integration within the IDE environment.

Step 1: Install the JetBrains HTTP Client

To start using the JetBrains HTTP client, first install it in your IDE. The HTTP client is built into JetBrains IntelliJ IDEA, PhpStorm, WebStorm, and PyCharm, so you don’t need to install anything extra.

Step 2: Create a New HTTP Request File

After installing the JetBrains HTTP client, open your IDE and create a new file by selecting FileNewHTTP Request. Here’s an example of a health check API provided by Gcore:

### HEALTH CHECKGET https://api.gcore.com/dns/healthcheck

A health check API is an endpoint that provides information about the health and status of an application or service. It allows you to assess programmatically the availability and readiness of critical components and determine if your application is functioning properly.

Health check APIs are commonly used in conjunction with monitoring and alerting systems to proactively detect issues and ensure system reliability. They are especially useful in distributed and microservices architectures, and are often integrated with containerization or orchestration systems.

Step 3: Add Request Headers

Request headers contain additional information about the request, such as the type of data being sent or authentication credentials. To add headers, click the Headers tab in the request window and provide the required information. Some of Gcore’s API requires an authorization header. Here’s an example of the GET zone API that requires a header:

### GET ZONEGET https://api.gcore.com/dns/v2/zones?limit=10Authorization: Bearer REPLACE_WITH_YOUR_TOKEN

Step 4: Add Request Body

If you need to send data with your request, you can add it to the request body. Click the Body tab, choose the type of data you want to send (JSON, XML, etc.,) and enter your data in the editor. Here’s an example of an API request to create a new zone on Gcore:

### CREATE ZONEPOST https://api.gcore.com/v2/zonesAuthorization: Bearer REPLACE_WITH_YOUR_TOKENContent-Type: application/json{  "name": "one.gcdn.co",  "primary_server": "ns1.example.com",  "serial": 1,  "nx_ttl": 1}

Step 5: Send the Request

Once you have completed the request configuration, click Run to send the request. To see the response, check the Response tab, which shows the response status code, headers, and body.

GET https://api.gcore.com/dns/healthcheckHTTP/1.1 200 OKServer: nginxDate: Tue, 20 Jun 2023 07:32:04 GMTContent-Type: application/json; charset=utf-8Content-Length: 124Connection: keep-aliveContent-Encoding: deflateVary: Accept-EncodingStrict-Transport-Security: max-age=15724800; includeSubDomainsCache: MISSX-ID: ed-up-gc38X-NGINX: nginx-beAccept-Ranges: bytesX-ID-FE: ed-up-gc38{  "app": "gcdn-dns-api",  "hash": "0b5371a",  "postgres_ping_success": true,  "uptime": "191h39m45.146275442s",  "uptime_seconds": 689985,  "version": "0b5371a"}Response file saved.> 2023-06-20T143205.200.jsonResponse code: 200 (OK); Time: 790ms (790 ms); Content length: 145 bytes (145 B)

Conclusion

JetBrains HTTP client is a useful tool for testing REST APIs and making HTTP requests. It is easy-to-use, informative, convenient for everyday usage. By following the steps outlined in this tutorial, you can easily use JetBrains HTTP client to test your APIs and analyze responses. Check out Gcore’s API docs to learn more.

Related articles

Achieving 3-Second Latency in Streaming: A Deep Dive into LL-HLS and LL-DASH Optimization with CDN

HLS/DASH streaming via CDN with ~3 seconds latency glass-to-glassLL-HLS and LL-DASH are well-documented standards, but delivering them reliably at scale is far from trivial. The challenge is not in understanding the protocols—it is in engin

New AI inference models on Application Catalog: translation, agents, and flagship reasoning

We’ve expanded our AI inference Application Catalog with three new state-of-the-art models, covering massively multilingual translation, efficient agentic workflows, and high-end reasoning. All models are live today via Everywhere Inference

New AI inference models available now on Gcore

We’ve expanded our Application Catalog with a new set of high-performance models across embeddings, text-to-speech, multimodal LLMs, and safety. All models are live today via Everywhere Inference and Everywhere AI, and are ready to deploy i

Introducing Gcore Everywhere AI: 3-click AI training and inference for any environment

For enterprises, telcos, and CSPs, AI adoption sounds promising…until you start measuring impact. Most projects stall or even fail before ROI starts to appear. ML engineers lose momentum setting up clusters. Infrastructure teams battle to b

Gcore partners with AVEQ to elevate streaming performance monitoring

At Gcore, delivering exceptional streaming experiences to users across our global network is at the heart of what we do. We're excited to share how we're taking our CDN performance monitoring to new heights through our partnership with AVEQ

How we engineered a single pipeline for LL-HLS and LL-DASH

Viewers in sports, gaming, and interactive events expect real-time, low-latency streaming experiences. To deliver this, the industry has rallied around two powerful protocols: Low-Latency HLS (LL-HLS) and Low-Latency DASH (LL-DASH).While th

Subscribe to our newsletter

Get the latest industry trends, exclusive insights, and Gcore updates delivered straight to your inbox.