Test passes with 'post request' but not 'POST On Session'

Noob Alert

Hey there,
New to API automation using Robot FW.
Not sure if I’m missing something really silly, but I’ve been sitting at my screen for hours trying to figure this out with no help from Google.

I’ve written a script for a Login POST request using a youtube tutorial that looks something like this:

Login
create session mysession {BASE_URL} {body}= create dictionary userName=testuser password=Password panelCode=string
{header}= create dictionary Content-Type=application/json {response}= POST On Session mysession /api/authentication/Login
data={body} headers={header}

 log to console  ${response.status_code}
 log to console  ${response.content}

 ${status_code}=  convert to string  ${response.status_code}
 should be equal  ${status_code}  200

The test keeps failing with the following error against keyword POST On Session:
“errors”:{"":["'u' is an invalid start of a value. Path: | LineNumber: 0 | BytePositionInLine: 0."]}}

I have tried adding single & double quotes to the body’s key value pairs - still fails.
Here’s the kicker → If I change ‘POST On Session’ to ‘post request’, the test PASSES!!!
Obviously this isn’t good because the keyword is deprecated, but I’m not sure what on earth I’m doing wrong :exploding_head:

Would really appreciate some help so that I can move forward. Could anybody point me in the right direction (or improve my googling skills) PLEASE?

TIA
J