\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}Published 21st June, 2026.\\ Updated 21st June, 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{tabularx}{17.67cm}{x{6.7353 cm} x{10.5347 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\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{17.67cm}}{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}{17.67cm}{x{7.0807 cm} x{10.1893 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\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{17.67cm}}{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}{17.67cm}{x{7.9442 cm} x{9.3258 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\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{17.67cm}}{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}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Input}} \tn % Row 0 \SetRowColor{LightBackground} RESTSetValue field value & Set body field \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{RESTSetValueAsString} field value & Always send the value as a string (no auto-conversion). \{\{nl\}\} {\bf{Example:}}\{\{nl\}\}RESTSetValueAsString zipcode 01234 \# -\textgreater{} "01234"\{\{nl\}\}RESTSetValueAsString flag true \# -\textgreater{} "true" \tn % Row Count 12 (+ 10) % Row 2 \SetRowColor{LightBackground} RESTSetValue ?param value & Set query parameter (? prefix) \tn % Row Count 14 (+ 2) % Row 3 \SetRowColor{white} RESTSetHeader name value & Set request header \tn % Row Count 16 (+ 2) % Row 4 \SetRowColor{LightBackground} RESTSetFile field filepath {[}mime\_type{]} & Set a file for multipart form-data upload. MIME type is auto-detected. Call multiple times for multiple files. \{\{nl\}\} {\bf{Example:}}\{\{nl\}\}RESTSetFile avatar photo.jpg\{\{nl\}\}RESTSetFile document report.pdf application/pdf\{\{nl\}\} {\bf{Multiple files (same field):}}\{\{nl\}\}RESTSetFile attachments file1.jpg\{\{nl\}\}RESTSetFile attachments file2.jpg \tn % Row Count 34 (+ 18) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{? 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}{17.67cm}{x{9.3258 cm} x{7.9442 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\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{17.67cm}}{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}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Auto Type Detection}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{RESTSetValue detects the JSON type automatically: \{\{nl\}\}\{\{nl\}\}Zoltan -\textgreater{} "Zoltan" (string)\{\{nl\}\}42 -\textgreater{} 42 (integer)\{\{nl\}\}3.14 -\textgreater{} 3.14 (float)\{\{nl\}\}true / false -\textgreater{} true / false (boolean)\{\{nl\}\}null / \$NULL -\textgreater{} null\{\{nl\}\}\$EMPTY -\textgreater{} "" (empty string) \{\{nl\}\}\{\{nl\}\}{\bf{Force string:}} Use RESTSetValueAsString\{\{nl\}\}RESTSetValueAsString zipcode 01234 \# -\textgreater{} "01234"} \tn % Row Count 8 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.1169 cm} x{9.1531 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\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} \seqsplit{RESTVerifyValueWCM} field {\emph{text}} & Wildcard match (* ?) \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{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) % Row 6 \SetRowColor{LightBackground} \seqsplit{RESTVerifyListCount} field expected & Verify the number of elements in a JSON array field. Context-aware. \{\{nl\}\} {\bf{Example:}}\{\{nl\}\}RESTVerifyListCount todos 3\{\{nl\}\}RESTVerifyListCount items 0 \tn % Row Count 20 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{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}{17.67cm}{x{8.1169 cm} x{9.1531 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\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{17.67cm}}{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}{17.67cm}{x{3.1086 cm} x{14.1614 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Tokens}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{\$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) % Row 3 \SetRowColor{white} \$NULL & Set field to JSON null. \{\{nl\}\} {\bf{Example:}}\{\{nl\}\}RESTSetValue comment \$NULL \# -\textgreater{} "comment": null \tn % Row Count 8 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{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}{17.67cm}{x{4.3175 cm} x{12.9525 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Phase Model}} \tn % Row 0 \SetRowColor{LightBackground} Start & RESTStart \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Scope & RESTSelectEndpoint, RESTSetContext \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Input & RESTSetValue, RESTSetValueAsString, RESTSetValueAsList, RESTSetFile, RESTSetHeader \tn % Row Count 6 (+ 3) % Row 3 \SetRowColor{white} Action & RESTSendRequest \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} Verify & RESTVerifyValue, RESTVerifyValueWCM, RESTVerifyValueREGX, RESTVerifyStatus, RESTVerifyResponseTime, RESTVerifyListCount, RESTVerifyHeader \tn % Row Count 12 (+ 5) % Row 5 \SetRowColor{white} Memorize & RESTMemorizeValue, RESTMemorizeBody \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} Save & RESTSaveResponseToFile \tn % Row Count 15 (+ 1) % Row 7 \SetRowColor{white} Stop & RESTStop \tn % Row Count 16 (+ 1) % Row 8 \SetRowColor{LightBackground} Config (YAML) & Retry, OAuth 2.0, Cookie Handling \tn % Row Count 18 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{Every REST test follows this sequence. Same pattern as OKW GUI keywords: StartApp → SelectWindow → SetValue → ClickOn → VerifyValue → StopApp. \newline \newline {\bf{Total: 20 keywords}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.1169 cm} x{9.1531 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\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) % Row 6 \SetRowColor{LightBackground} File Upload & OKW: RESTSetFile | PW: multipart option \tn % Row Count 15 (+ 2) % Row 7 \SetRowColor{white} Array Values & OKW: RESTSetValueAsList | PW: JSON inline \tn % Row Count 17 (+ 2) % Row 8 \SetRowColor{LightBackground} Auto Typing & OKW: automatic | PW: manual (JSON) \tn % Row Count 19 (+ 2) % Row 9 \SetRowColor{white} Cookie Handling & OKW: automatic | PW: context.cookies() \tn % Row Count 21 (+ 2) % Row 10 \SetRowColor{LightBackground} Retry & OKW: YAML config | PW: custom logic \tn % Row Count 23 (+ 2) % Row 11 \SetRowColor{white} OAuth 2.0 & OKW: YAML config | PW: custom logic \tn % Row Count 25 (+ 2) % Row 12 \SetRowColor{LightBackground} Response to File & OKW: \seqsplit{RESTSaveResponseToFile} | PW: fs.writeFile() \tn % Row Count 28 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{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} \begin{tabularx}{17.67cm}{x{7.5988 cm} x{9.6712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Save}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{RESTSaveResponseToFile} filepath & Save response body (bytes) to a file. Binary-safe (PDF, ZIP, images).\{\{nl\}\}Directories are created automatically. Existing file is overwritten (warning in log). \{\{nl\}\} {\bf{Supports:}} `\$MEM\{\}, \textbackslash{}\textasciitilde{}, \$ENV\_VAR, \$IGNORE'\{\{nl\}\} {\bf{Example:}}\{\{nl\}\}RESTSaveResponseToFile C:/temp/response.json\{\{nl\}\}RESTSaveResponseToFile \textbackslash{}\textasciitilde{}/downloads/report.pdf \tn % Row Count 17 (+ 17) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Arrays}} \tn % Row 0 \SetRowColor{LightBackground} RESTSetValueAsList field val1 val2 ... & {\bf{Compact:}}\{\{nl\}\}RESTSetValueAsList tags a b c\{\{nl\}\}\# -\textgreater{} "tags": {[}"a", "b", "c"{]} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} RESTSetValue field{[}index{]} value & {\bf{Index syntax:}}\{\{nl\}\}RESTSetValue scores{[}0{]} 42\{\{nl\}\}RESTSetValue scores{[}1{]} 87\{\{nl\}\}\# -\textgreater{} "scores": {[}42, 87{]} \tn % Row Count 11 (+ 6) % Row 2 \SetRowColor{LightBackground} RESTSetValueAsList field & {\bf{Empty array:}}\{\{nl\}\}RESTSetValueAsList items\{\{nl\}\}\# -\textgreater{} "items": {[}{]} \tn % Row Count 15 (+ 4) % Row 3 \SetRowColor{white} RESTVerifyListCount field count & {\bf{Verify length:}}\{\{nl\}\}RESTVerifyListCount tags 3 \tn % Row Count 18 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.1169 cm} x{9.1531 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{File Upload}} \tn % Row 0 \SetRowColor{LightBackground} RESTSetFile field filepath {[}mime{]} & Set file for multipart upload. MIME is auto-detected. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} RESTSetFile + RESTSetValue & Text fields from RESTSetValue are sent as form fields alongside files. \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} Multiple files & all RESTSetFile multiple times — files accumulate until RESTSelectEndpoint resets them. \tn % Row Count 12 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{RESTSendRequest automatically switches from JSON to multipart/form-data when files are present. \{\{nl\}\} {\bf{Example:}}\{\{nl\}\}RESTSelectEndpoint /api/upload\{\{nl\}\}RESTSetValue title Report\{\{nl\}\}RESTSetFile file report.pdf\{\{nl\}\}RESTSendRequest POST} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.8718 cm} x{11.3982 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Retry}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{retry\_count:} 3 & Max retries (default: 0 = off) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{retry\_delay:} 1000 & Delay between retries in ms (default: 1000) \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} retry\_on: 429,502,503 & Status codes that trigger retry \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{Configure in YAML \_\_self\_\_ — no keyword needed. After all retries exhausted: last status is kept, RESTVerifyStatus will fail. \{\{nl\}\} {\bf{Log:}}\{\{nl\}\}\textless{}\textless{}\textless{} 429 — retry 1/3 (waiting 1000ms)\{\{nl\}\}\textless{}\textless{}\textless{} 429 — retry 2/3 (waiting 1000ms)\{\{nl\}\}\textless{}\textless{}\textless{} 200 OK} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{OAuth 2.0}} \tn % Row 0 \SetRowColor{LightBackground} auth\_type: \seqsplit{oauth2\_client\_credentials} & Machine-to-machine API access \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} token\_url: \seqsplit{https://auth.example.com/oauth/token} & OAuth token endpoint \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} client\_id / client\_secret: \$\{...\} & From env file (\textbackslash{}\textasciitilde{}/.okw/env/env-test.yaml) \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} scope: read write & Space-separated scopes (optional) \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{RESTStart fetches the access token automatically. Authorization: Bearer \textless{}token\textgreater{} is set on every request. \{\{nl\}\} {\bf{Test:}}\{\{nl\}\}RESTStart MyAPI env-test\{\{nl\}\}RESTSelectEndpoint /api/data\{\{nl\}\}RESTSendRequest GET\{\{nl\}\}RESTVerifyStatus 200\{\{nl\}\}RESTStop} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{7.0807 cm} x{10.1893 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Cookie Handling}} \tn % Row 0 \SetRowColor{LightBackground} Automatic \seqsplit{(requests.Session)} & Server sends Set-Cookie -\textgreater{} cookie is stored. Subsequent requests send the cookie automatically. No new keyword needed. \tn % Row Count 6 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{{\bf{Example (login with session cookie):}}\{\{nl\}\}RESTSelectEndpoint /auth/login\{\{nl\}\}RESTSetValue username admin\{\{nl\}\}RESTSendRequest POST \# Set-Cookie stored\{\{nl\}\}RESTSelectEndpoint /api/data \# cookie sent automatically\{\{nl\}\}RESTSendRequest GET\{\{nl\}\}RESTVerifyStatus 200} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.181 cm} x{12.089 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Header Logging}} \tn % Row 0 \SetRowColor{LightBackground} Request headers & Logged after \textgreater{}\textgreater{}\textgreater{} POST url in cleartext \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Response headers & Logged after \textless{}\textless{}\textless{} 200 OK in cleartext \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{All request and response headers are logged in cleartext for maximum observability. Body fields (password, token, secret) are masked with ***. \{\{nl\}\} {\bf{Log:}}\{\{nl\}\}\textgreater{}\textgreater{}\textgreater{} POST https://api.example.com/login\{\{nl\}\} Headers:\{\{nl\}\} Content-Type: application/json\{\{nl\}\}\textless{}\textless{}\textless{} 200 OK\{\{nl\}\} Headers:\{\{nl\}\} Set-Cookie: JSESSIONID=abc123; Path=/; HttpOnly} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.8718 cm} x{11.3982 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{YAML Config}} \tn % Row 0 \SetRowColor{LightBackground} Basic YAML & ServiceName.yaml in locators/ folder: \{\{nl\}\}\{\{nl\}\}`ServiceName:\{\{nl\}\} \_\_self\_\_:\{\{nl\}\} class: okw\_api\_rest.library.OkwApiRestLibrary\{\{nl\}\} base\_url: https://api.example.com\{\{nl\}\} content\_type: application/json` \tn % Row Count 9 (+ 9) % Row 1 \SetRowColor{white} With Environment File & YAML with \$\{VAR\} placeholders — resolved from env file: \{\{nl\}\}\{\{nl\}\}`ServiceName:\{\{nl\}\} \_\_self\_\_:\{\{nl\}\} base\_url: \$\{BASE\_URL\}\{\{nl\}\} content\_type: \$\{CONTENT\_TYPE\}\{\{nl\}\}\{\{nl\}\}{\bf{env-test.yaml}} (in \textasciitilde{}/.okw/env/): \{\{nl\}\}BASE\_URL: https://api.example.com\{\{nl\}\}CONTENT\_TYPE: application/json` \tn % Row Count 21 (+ 12) % Row 2 \SetRowColor{LightBackground} \seqsplit{Authentication} (YAML) & {\bf{Basic Auth:}}\{\{nl\}\}'auth\_type: basic\{\{nl\}\}auth\_user: \$\{API\_USER\}\{\{nl\}\}auth\_password: \$\{API\_PASSWORD\}\{\{nl\}\}\{\{nl\}\}{\bf{API Key:}}\{\{nl\}\}auth\_type: api\_key\{\{nl\}\}auth\_header: X-API-Key\{\{nl\}\}auth\_key: \$\{API\_KEY\}\{\{nl\}\}\{\{nl\}\}{\bf{Bearer Token:}}\{\{nl\}\}auth\_type: bearer\{\{nl\}\}auth\_token: \$\{AUTH\_TOKEN\}' \tn % Row Count 33 (+ 12) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.8718 cm} x{11.3982 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{YAML Config (cont)}} \tn % Row 3 \SetRowColor{LightBackground} SSL / Certificates & verify\_ssl: false \# self-signed certs\{\{nl\}\}client\_cert: \textasciitilde{}/.okw/certs/client.pem\{\{nl\}\}client\_key: \textasciitilde{}/.okw/certs/client.key\{\{nl\}\}ca\_bundle: \textasciitilde{}/.okw/certs/ca-bundle.pem \tn % Row Count 7 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{All settings go in \_\_self\_\_. Credentials use \$\{VAR\} placeholders resolved from env files — no secrets in YAML. OAuth 2.0 and Retry are also configured here (see separate blocks).} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \end{document}