1

I have python code that run WGET to run API (Get\Post,ETC)

I want to do the same with ROBOT but having problem with syntax probably.

My python code to run api:

APIWGET = [WGETInstallationFolder,"--post-data="+PostFile,"--output-file="+TempReadWritePath + 'TempReadWriteFile' + TimeNow + '.txt',"--wait=2","--content-on-error", "--header="+HeaderTokenAdmin1+TokenToVar,"--header="+Header, "--output-document="+TempReadWritePath + 'TempReadWriteFile' + TimeNow + '.txt',"--timeout=3","--tries=3", "--save-headers", "http://" + BEIP +":8080/lms/v1/components"]

I want to Post json :{ "type": "IDU", "serial_number": "00000000601C7898"}' I want to use headers : auth-token: abcde1111 & Content-Type: application/json

I'm using ride on windows and have tried to use post keyword from "request" lib

Please see attached screen shot describes what I did[Image with Ride screenshot]

1
  • Didn't manage to pass the scrennshot Commented Feb 17, 2016 at 9:51

1 Answer 1

1

Hope this example can help you:

${auth}    Create List    <username>    <password>
Create Session    my_session    <URL>    auth=${auth}
${headers}    Create Dictionary    Accept    application/json    Content-Type    application/json
${resp}    POST    my_session    <your rest api>    data=<JSON DATA>    headers=${headers}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.