Show Menu
Cheatography

robotframework-okw-api-rest Quick Reference Cheat Sheet (DRAFT) by

Quick reference for OKW REST API testing keywords (Robot Framework). Covers the complete test lifecycle: Start, Scope, Input, Action, Verify, Memorize, Stop. Designed for AI-friendly test generation — no JSON blocks, just field names and values.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Setup

Install library
pip install robotf­ram­ewo­rk-­okw­-ap­i-rest
Import in Settings
Library okw_ap­i_r­est.li­bra­ry.O­kw­Api­Res­tLi­brary WITH NAME RESTAPI
Minimum Python version
Python >= 3.10
Minimum RF version
robotf­ram­ework >= 6.0
YAML locator file required: locato­rs/­Ser­vic­eNa­me.yaml with __self­__.b­as­e_url and __self­__.c­on­ten­t_type. See README for full YAML examples.

Start / Stop

RESTStart service
Start REST service (load YAML)
RESTStart service env
Start with enviro­nment file
RESTStop
Stop REST service
YAML config separates URLs and creden­tials from test code. Enviro­nment files are searched in: ~/.okw­/env/ → $OKW_E­NV_DIR → locators/ → OS env vars.

Scope

RESTSe­lec­tEn­dpoint /path
Select endpoint (resets body/h­eaders)
RESTSe­tCo­ntext path
Navigate into nested JSON
RESTSe­tCo­ntext custom­er.a­ddress
Deeper nesting via dot notation
RESTSe­tCo­ntext items[0]
Select array element
RESTSe­lec­tEn­dpoint resets body, headers, and context. Each RESTSe­tCo­ntext replaces the previous one (flat, no stack).

Input

RESTSe­tValue field value
Set body field
RESTSe­tValue ?param value
Set query parameter (? prefix)
RESTSe­tHeader name value
Set request header
? prefix sends field as URL query parameter instead of body field. Query parameters are not affected by RESTSe­tCo­ntext. Password fields are masked (*) in logs.

Action

RESTSe­ndR­equest GET
Send GET request
RESTSe­ndR­equest POST
Send POST request
RESTSe­ndR­equest PUT
Send PUT request
RESTSe­ndR­equest PATCH
Send PATCH request
RESTSe­ndR­equest DELETE
Send DELETE request
Request and response bodies are logged as formatted JSON. After sending, all RESTVerify and RESTMe­morize keywords operate on this response.
 

Verify

RESTVe­rif­yStatus 200
Verify HTTP status code
RESTVe­rif­yValue field expected
Verify field value (exact match)
RESTVe­rif­yVa­lueWCM field text
Wildcard match (* ?)
RESTVe­rif­yVa­lueREGX field ^[a-f]+$
Regex match
RESTVe­rif­yHeader name expected
Verify response header
RESTVe­rif­yRe­spo­nseTime 500
Response time < 500ms
Dot notation for nested fields: data.u­ser.name. With active context, fields resolve relative to context path. Respon­seTime checks elapsed time, not timeout.

Memorize

RESTMe­mor­ize­Value field NAME
Store response field value
RESTMe­mor­izeBody NAME
Store entire response body
$MEM{NAME}
Use stored value in next request
Use $MEM{NAME} in any keyword: RESTSe­tValue, RESTSe­tHe­ader, RESTSe­lec­tEn­dpoint. Missing keys cause an immediate error. Values persist across endpoints until RESTStop.

Tokens

$IGNORE
Skip keyword (no-op)
$EMPTY
Empty string
$MEM{KEY}
Stored value from RESTMe­mor­ize­Value
RESTSe­tValue email $IGNORE → field not sent. RESTSe­tValue email $EMPTY → field sent as "­". RESTSe­tHeader x-auth­-token $MEM{T­OKEN} → inserts stored token value.

Phase Model

Start
RESTStart
Scope
RESTSe­lec­tEn­dpoint
Input
RESTSe­tValue / RESTSe­tCo­ntext / RESTSe­tHeader
Action
RESTSe­ndR­equest
Verify
RESTVe­rif­yValue / RESTVe­rif­yStatus
Memorize
RESTMe­mor­ize­Value
Stop
RESTStop
Every REST test follows this sequence. Same pattern as OKW GUI keywords: StartApp → Select­Window → SetValue → ClickOn → Verify­Value → StopApp.

vs. Playwright (Code-­Based)

data: { title: 'Test' }
RESTSe­tValue title Test
expect­(re­spo­nse.st­atu­s()­).t­oBe­(201)
RESTVe­rif­yStatus 201
const body = await respon­se.j­son()
Not needed — automatic
expect­(bo­dy.t­it­le).to­Be(­'Test')
RESTVe­rif­yValue title Test
if (email) payloa­d.email = email
RESTSe­tValue email $IGNORE
{ nested: { key: 'val' } }
RESTSe­tCo­ntext nested + RESTSe­tValue key val
No JSON syntax, no async/­await, no variable assign­ments. Field name + value — readable by testers, BAs, and AI. Same keyword model for GUI and API testing.