*** Settings ***
Library RequestsLibrary
Library Collections
Library OperatingSystem
*** Variables ***
${baseUrl} https://simple-books-api.glitch.me
${headers} Content-Type=application/json;charset=utf-8 Authorization=Bearer TOKEN
*** Test Cases ***
OrderBook
create session mysession ${baseUrl} verify=true
${body}= create dictionary bookId=1 customerName=John Doe
LOG TO CONSOLE ${body}
${response}= post on session mysession /orders data=${body} headers=${headers}
log to console ${response}
log to console ${response.status_code}
log to console ${response.content}
#validations
${res_body}= convert to string ${response.content}
should contain ${res_body} true
#should contain ${res_body} {{bookId}}
I want to send a POST command through robot framework but keep getting
AttributeError: ‘str’ object has no attribute ‘items’
Can someone help me what i’m doing wrong in my code?
I feel like the fault is in the key:value i’m sending to the API. The bookId key only accepts integers and customerName are strings