\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{ZH (openkeyword)} \pdfinfo{ /Title (robotframework-okw-api-rest-quick-reference.pdf) /Creator (Cheatography) /Author (ZH (openkeyword)) /Subject (robotframework-okw-api-rest Quick Reference Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{4CAF50} \definecolor{LightBackground}{HTML}{F3FAF4} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{robotframework-okw-api-rest Quick Reference Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{ZH (openkeyword)} via \textcolor{DarkBackground}{\uline{cheatography.com/68516/cs/48143/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}ZH (openkeyword) \\ \uline{cheatography.com/openkeyword} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 31st May, 2026.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{x{3.12 cm} x{4.88 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Setup}} \tn % Row 0 \SetRowColor{LightBackground} Install library & `pip install \seqsplit{robotframework-okw-api-rest`} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Import in {\bf{{\emph{ Settings }}}} & `Library \seqsplit{okw\_api\_rest.library.OkwApiRestLibrary} WITH NAME RESTAPI` \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} Minimum Python version & Python \textgreater{}= 3.10 \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} Minimum RF version & robotframework \textgreater{}= 6.0 \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{YAML locator file required: \seqsplit{locators/ServiceName.yaml} with \_\_self\_\_.base\_url and \seqsplit{\_\_self\_\_.content\_type.} See README for full YAML examples.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.28 cm} x{4.72 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Start / Stop}} \tn % Row 0 \SetRowColor{LightBackground} RESTStart service & Start REST service (load YAML) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} RESTStart service env & Start with environment file \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} RESTStop & Stop REST service \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{YAML config separates URLs and credentials from test code. Environment files are searched in: \textasciitilde{}/.okw/env/ → \$OKW\_ENV\_DIR → locators/ → OS env vars.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.68 cm} x{4.32 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Scope}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{RESTSelectEndpoint} /path & Select endpoint (resets body/headers) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} RESTSetContext path & Navigate into nested JSON \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} RESTSetContext customer.address & Deeper nesting via dot notation \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} RESTSetContext items{[}0{]} & Select array element \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{RESTSelectEndpoint resets body, headers, and context. Each RESTSetContext replaces the previous one (flat, no stack).} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.6 cm} x{4.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Input}} \tn % Row 0 \SetRowColor{LightBackground} RESTSetValue field value & Set body field \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} RESTSetValue ?param value & Set query parameter (? prefix) \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} RESTSetHeader name value & Set request header \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{? prefix sends field as URL query parameter instead of body field. Query parameters are not affected by RESTSetContext. Password fields are masked ({\emph{*}}) in logs.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.32 cm} x{3.68 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Action}} \tn % Row 0 \SetRowColor{LightBackground} RESTSendRequest GET & Send GET request \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} RESTSendRequest POST & Send POST request \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} RESTSendRequest PUT & Send PUT request \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} RESTSendRequest PATCH & Send PATCH request \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} RESTSendRequest DELETE & Send DELETE request \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Request and response bodies are logged as formatted JSON. After sending, all RESTVerify{\emph{ and RESTMemorize}} keywords operate on this response.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.16 cm} x{3.84 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Verify}} \tn % Row 0 \SetRowColor{LightBackground} RESTVerifyStatus 200 & Verify HTTP status code \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} RESTVerifyValue field expected & Verify field value (exact match) \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} RESTVerifyValueWCM field {\emph{text}} & Wildcard match (* ?) \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} RESTVerifyValueREGX field \textasciicircum{}{[}a-f{]}+\$ & Regex match \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} RESTVerifyHeader name expected & Verify response header \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \seqsplit{RESTVerifyResponseTime} 500 & Response time \textless{} 500ms \tn % Row Count 12 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Dot notation for nested fields: data.user.name. With active context, fields resolve relative to context path. ResponseTime checks elapsed time, not timeout.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.76 cm} x{4.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Memorize}} \tn % Row 0 \SetRowColor{LightBackground} RESTMemorizeValue field NAME & Store response field value \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} RESTMemorizeBody NAME & Store entire response body \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \$MEM\{NAME\} & Use stored value in next request \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Use \$MEM\{NAME\} in any keyword: RESTSetValue, RESTSetHeader, RESTSelectEndpoint. Missing keys cause an immediate error. Values persist across endpoints until RESTStop.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.6 cm} x{6.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Tokens}} \tn % Row 0 \SetRowColor{LightBackground} \$IGNORE & Skip keyword (no-op) \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \$EMPTY & Empty string \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \$MEM\{KEY\} & Stored value from RESTMemorizeValue \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{RESTSetValue email \$IGNORE → field not sent. RESTSetValue email \$EMPTY → field sent as "". RESTSetHeader x-auth-token \$MEM\{TOKEN\} → inserts stored token value.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.36 cm} x{6.64 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Phase Model}} \tn % Row 0 \SetRowColor{LightBackground} Start & RESTStart \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Scope & RESTSelectEndpoint \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Input & RESTSetValue / RESTSetContext / RESTSetHeader \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{Action} & RESTSendRequest \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \seqsplit{Verify} & RESTVerifyValue / RESTVerifyStatus \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} \seqsplit{Memorize} & RESTMemorizeValue \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} Stop & RESTStop \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Every REST test follows this sequence. Same pattern as OKW GUI keywords: StartApp → SelectWindow → SetValue → ClickOn → VerifyValue → StopApp.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.76 cm} x{4.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{vs. Playwright (Code-Based)}} \tn % Row 0 \SetRowColor{LightBackground} data: \{ title: 'Test' \} & RESTSetValue title Test \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{expect(response.status()).toBe(201)} & RESTVerifyStatus 201 \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} const body = await response.json() & Not needed — automatic \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{expect(body.title).toBe('Test')} & RESTVerifyValue title Test \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} if (email) payload.email = email & RESTSetValue email \$IGNORE \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \{ nested: \{ key: 'val' \} \} & RESTSetContext nested + RESTSetValue key val \tn % Row Count 13 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{No JSON syntax, no async/await, no variable assignments. Field name + value — readable by testers, BAs, and AI. Same keyword model for GUI and API testing.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}