Working with HTTP and APIs
API-based automation approach
Even though when discussing RPA in general, the emphasis is often on the fact that RPA enables automation even where APIs are not available, when they actually are, it's a good idea to use them.
An API will change less often than a user interface and will generally be built with the developer in mind. If best practices are followed, it will have versioning, breaking changes will be announced and managed, and it will constitute a solid base for your automation projects. And then, if the API does not cover 100% of what you need to accomplish with a specific service or application, you can still go ahead and combine your API-based approach with one or more additional approaches, like browser automation, image-based locators, etc.
Which automation library should you use?
To interact with APIs and HTTP servers, you can use the
RPA.HTTP library, part of RPA Framework. It builds upon the
requests Python library, and the corresponding
robotframework-requests Robot Framework library.
Getting started with
- Check the excellent Quickstart material for the Requests Python library to get an overview of the main concepts related to the functioning of the library.
- Learn how to use all HTTP request methods with Robot Framework.
Added convenience methods
RPA.HTTP library adds some convenience methods for very simple operations. These methods do not require to set up a session, for example.
Downloadkeyword can be used to easily download files.
Http Getkeyword can be used to perform GET requests.