Description of problem: When trying to create a service through the api, the command fails with a bad request error - the error indicates a hash was received instead of a picture. Version-Release number of selected component (if applicable): 5.9.7 How reproducible: all the time Steps to Reproduce: 1. upload a picture using curl (encode it in base64) 2. create a service 3. edit the service through the api to use a different picture Actual results: curl -k --user admin:smartvm -X POST -d @photo2.crl -H "Accept: application/json" -g "https://IP//api/service_templates/101000000000023" | python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 474 0 160 100 314 114 225 0:00:01 0:00:01 --:--:-- 225 { "error": { "kind": "bad_request", "klass": "Api::BadRequestError", "message": "Could not update Service Template - Picture(#129832020) expected, got Hash(#3879260)" } } Expected results: able to use the uploaded picture to edit the service Additional info: similar issue happens when trying to create the service with a picture from the api, but the most information I have around this issue is on edition.
@Mike Sure, I can modify the method to include a picture. @Felix I passed `picture` while creating a service template, and got an error similar to yours, can you confirm if the query looks okay? POST /api/service_templates Query: { "name": "item_EfN40", "prov_type": "generic", "service_template_catalog_id": "7", "config_info": { "retirement": { "fqname": "/Service/Retirement/StateMachines/ServiceRetirement/Default", "dialog_id": "8" }, "provision": { "fqname": "/Service/Provisioning/StateMachines/ServiceProvision_Template/CatalogItemInitialization", "dialog_id": "8" } }, "service_type": "atomic", "display": true, "description": "mycatalogEfN40", "picture": { "content": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsTAAALEwEAmpwYAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAAADUlEQVQIHWNgYGCwBQAAQgA+3N0+xQAAAABJRU5ErkJggg==", "extension": "jpg" } } Response: { "error": { "kind": "bad_request", "message": "Could not create Service Template - Picture(#124586900) expected, got Hash(#15233320)", "klass": "Api::BadRequestError" } }
yes, that looks correct - the content being a base64 encoded picture.
https://github.com/ManageIQ/manageiq/pull/18674
https://github.com/ManageIQ/manageiq/pull/18689
FIXED. Verified on 5.11.0.2.20190430174828_0e34dea.