I am trying to pass the below API request in ROBOT framework:
curl --request POST --url <API End Point> --form 'mldata={"id": “idname”, "author": “author name, "title": “title name, "description": “description details“, "version": "0.0.4", "image": “/path/to/image”, "icon": "base64 encoded image"};type=application/json' --header "Authorization: <Bearer Token>”
Written the same in ROBOT framework [Version: 3.2.2], but getting error: "status=400, reason=Bad Request body={"message":"Request is not a multipart request!"}"
strong text
It seems I am not passing the --form data in a right way. Request for help in passing the form data [--form 'mldata={"id": “idname”, "author": “author name, "title": “title name, "description": “description details“, "version": "0.0.4", "image": “/path/to/image”, "icon": "base64 encoded image"};type=application/json'] in robot framework.
How should I pass in the right way?
Onboard ML From External Repo
[Arguments] ${token}=default
Create Session session ${host}
${data}= Create Dictionary id=${id} author=${author} title=${title} description=${description} version=${version} image=${repo_path}
${form_data}= Evaluate {'mldata=': ${data}}
${header}= Create Dictionary Authorization=${token}
${response}= Post Request session /v1/ml data=${form_data} headers=${header}
Should Be Equal As Strings ${response.status_code} 200
It should be send as a string , and also you don't need equal
${form_data}= Evaluate {'mldata=': str(${data}).replace("'",'"')}
As you observed , we have to pass this as
files=${form_data}