This short tutorial shows how you set-up a REST Call in APM Studio in a Processing Rule. The tutorial uses the publicly available REST endpoint of Coindesk for the current Bitcoin price.
The tutorial shows:
- The creation and configuration of a REST Endpoint Task;
- The configuration of the loop of the REST Endpoint Task;
- The logging of the JSON parsed value of the current Bitcoin price; and
- The activation of the Processing Rule.
As the REST endpoint of Coindesk is called the Diagram Log of the Processing Rule in APM Studio is updated to show the current Bitcoin price.
Background information
A REST API (Representational State Transfer Application Programming Interface) is a set of rules and conventions that allow different systems to communicate over the internet using standard HTTP methods.
REST APIs follow six key principles:
- Stateless: Each request from a client contains all the information needed, and the server doesn’t store any client state between requests.
- Client-Server Architecture: The client and server are separate entities, allowing them to evolve independently.
- Uniform Interface: The API should have consistent resource naming and standard methods.
- Cacheability: Responses can be cached to improve performance.
- Layered System: The API can have multiple layers (security, caching, load balancing, etc.).
- Code on Demand (Optional): The server can send executable code (e.g., JavaScript) to the client.
REST APIs use standard HTTP methods to perform operations:
- GET: Retrieve data from a server (e.g., GET /users to get a list of users).
- POST: Create a new resource (e.g., POST /users to add a new user).
- PUT: Update an existing resource (e.g., PUT /users/1 to update user with ID 1).
- PATCH: Partially update a resource.
- DELETE: Remove a resource (e.g., DELETE /users/1 to delete user 1).
Most REST APIs use JSON or XML to structure their responses. In the tutorial a JSON response is received from Coindesk and further processed in APM Studio.