From rf-agentskills
Guides creation of REST API tests using Robot Framework's RequestsLibrary for HTTP methods, sessions, JSON/XML handling, auth, file uploads, and response validation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/rf-agentskills:requestsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
RequestsLibrary provides HTTP client keywords for REST API testing, wrapping Python's requests library. It supports JSON, XML, form data, file uploads, and all authentication methods.
assets/examples/authentication-patterns.robotassets/examples/basic-crud.robotassets/examples/file-upload.robotassets/examples/session-handling.robotreferences/authentication.mdreferences/http-methods.mdreferences/keywords-reference.mdreferences/request-options.mdreferences/response-validation.mdreferences/troubleshooting.mdRequestsLibrary provides HTTP client keywords for REST API testing, wrapping Python's requests library. It supports JSON, XML, form data, file uploads, and all authentication methods.
pip install robotframework-requests
*** Settings ***
Library RequestsLibrary
Library Collections # Often needed for dict/list operations
Direct HTTP calls without session management:
${response}= GET https://api.example.com/users
${response}= POST https://api.example.com/users json=${data}
${response}= PUT https://api.example.com/users/1 json=${data}
${response}= DELETE https://api.example.com/users/1
Create a session once, reuse for multiple requests:
Create Session api https://api.example.com verify=${True}
${response}= GET On Session api /users
${response}= POST On Session api /users json=${data}
${response}= DELETE On Session api /users/1
| Keyword | Usage | Description |
|---|---|---|
GET | GET ${URL} | Retrieve resource |
POST | POST ${URL} json=${data} | Create resource |
PUT | PUT ${URL} json=${data} | Replace resource |
PATCH | PATCH ${URL} json=${data} | Partial update |
DELETE | DELETE ${URL} | Remove resource |
HEAD | HEAD ${URL} | Get headers only |
OPTIONS | OPTIONS ${URL} | Get allowed methods |
| Option | Example | Description |
|---|---|---|
json | json=${dict} | Send JSON body |
data | data=${form} | Send form data |
params | params=${query} | URL query parameters |
headers | headers=${headers} | Custom headers |
expected_status | expected_status=201 | Verify status code |
timeout | timeout=30 | Request timeout (seconds) |
verify | verify=${False} | SSL verification |
&{user}= Create Dictionary name=John [email protected]
${response}= POST ${API_URL}/users json=${user}
${response}= GET ${API_URL}/users/1
${json}= Set Variable ${response.json()}
${name}= Set Variable ${json}[name]
${email}= Set Variable ${json}[email]
# Response: {"user": {"profile": {"name": "John"}}}
${name}= Set Variable ${response.json()}[user][profile][name]
# In request (recommended)
${response}= GET ${URL} expected_status=200
${response}= POST ${URL} json=${data} expected_status=201
${response}= DELETE ${URL} expected_status=204
# Post-request
Status Should Be 200 ${response}
Should Be Equal As Integers ${response.status_code} 200
# Accept any status (for error testing)
${response}= GET ${URL}/notfound expected_status=anything
Should Be Equal ${response.json()}[status] success
Should Contain ${response.text} success
Dictionary Should Contain Key ${response.json()} id
Should Not Be Empty ${response.json()}[name]
&{headers}= Create Dictionary
... Authorization=Bearer ${TOKEN}
... Content-Type=application/json
... Accept=application/json
${response}= GET ${URL} headers=${headers}
${content_type}= Set Variable ${response.headers}[Content-Type]
Should Contain ${content_type} application/json
*** Test Cases ***
CRUD User Lifecycle
# Create
&{user}= Create Dictionary name=John [email protected]
${response}= POST ${API}/users json=${user} expected_status=201
${user_id}= Set Variable ${response.json()}[id]
# Read
${response}= GET ${API}/users/${user_id} expected_status=200
Should Be Equal ${response.json()}[name] John
# Update
&{updates}= Create Dictionary name=John Updated
${response}= PUT ${API}/users/${user_id} json=${updates} expected_status=200
Should Be Equal ${response.json()}[name] John Updated
# Delete
${response}= DELETE ${API}/users/${user_id} expected_status=204
# Bearer Token
&{headers}= Create Dictionary Authorization=Bearer ${TOKEN}
${response}= GET ${URL} headers=${headers}
# Basic Auth (using auth parameter)
${auth}= Create List ${USERNAME} ${PASSWORD}
${response}= GET ${URL} auth=${auth}
&{params}= Create Dictionary page=1 limit=10 sort=name
${response}= GET ${API}/users params=${params}
# Results in: GET /users?page=1&limit=10&sort=name
| Property | Description | Example |
|---|---|---|
status_code | HTTP status code | ${response.status_code} |
text | Response body as text | ${response.text} |
json() | Parse JSON response | ${response.json()} |
headers | Response headers dict | ${response.headers}[Content-Type] |
content | Response body as bytes | ${response.content} |
cookies | Response cookies | ${response.cookies} |
elapsed | Request duration | ${response.elapsed.total_seconds()} |
# Verifies the response status code is in the 2xx range
${response}= GET ${URL}/users
Request Should Be Successful ${response}
# Client certificate authentication session
Create Client Cert Session alias ${URL} client_certs=${CURDIR}/client.pem
# Digest authentication session
Create Digest Session alias ${URL} auth=${auth}
# NTLM authentication session
Create Ntlm Session alias ${URL} auth=${auth}
Create Session has verify=${False} by default -- SSL verification is OFF.
For production environments, always explicitly enable SSL verification:
# INSECURE (default) -- do NOT use in production
Create Session api ${URL}
# SECURE -- explicitly enable SSL verification
Create Session api ${URL} verify=${True}
Load these reference files for specific use cases:
references/http-methods.mdreferences/request-options.mdreferences/response-validation.mdreferences/authentication.mdreferences/keywords-reference.mdreferences/troubleshooting.md| Need | Skill |
|---|---|
| Generate user keywords | keyword-builder |
| Generate test cases | testcase-builder |
| Design resource file layout | resource-architect |
| Search for keywords across libraries | libdoc-search |
| Explain keyword arguments in detail | libdoc-explain |
| Parse test results from output.xml | results |
npx claudepluginhub manykarim/robotframework-agentskills --plugin rf-agentskillsGuides creation of REST API tests using RESTinstance Robot Framework library with JSON Schema validation, built-in assertions, response field checks, and OpenAPI integration.
Tests REST API endpoints: validates requests/responses/auth, generates curl/Postman/scripts, load tests concurrency/response times, security scans injections/XSS/CORS.
Generates `.connekt.kts` scripts for HTTP automation and API testing using the Connekt DSL. Activates when writing, creating, or editing Connekt scripts, testing REST APIs, or automating HTTP workflows.