PAPI / assets / SOAP / file doesn't have .wsdl, .xsd, .json, or .wadl extension when using postman
search cancel

PAPI / assets / SOAP / file doesn't have .wsdl, .xsd, .json, or .wadl extension when using postman

book

Article ID: 202484

calendar_today

Updated On:

Products

CA API Developer Portal

Issue/Introduction

Unable to add a assets  to a API using PAPI calls from postman .

when sending the an request from postman PAPI  to /api-management/1.0/apis/{uuidAPI}/assets

It fails with  

"userErrorMessage": "The request could not be completed due to data input errors.",          

"error": "File doesn't have .wsdl, .xsd, .json, or .wadl extension",              

"key": "File doesn't have .wsdl, .xsd, .json, or .wadl extension"         

 The file we try to upload has the right extension and is correct as it can be uploaded with curl or in the Portal GUI.

Environment

Release : 4.5

Component : API PORTAL

Resolution

The problem is the body in  postman  

If we look what curl sends

curl -i -X POST -H "Content-Type:multipart/form-data" -H "Origin:https://apim.portaldomain" -H "Authorization: Bearer <TOKEN>" -F "files=@\"./api.wsdl\";filename=\"api.wsdl\"" 'https://apim-ssg.portaldomain:9443/tenantname/api-management/1.0/apis/ff894666-0ad9-404c-8be3-7cdddd23b249/assets ' -k -v --trace test.txt

The trace shows we send

Content-Disposition: form-data; name="files"; filename="api.wsdl"..Content-Type: application/octet-stream.... and  filename (type=text) sendEncaissement.wsdl Content-Disposition/form-data

So after adding in the postman  request body for the following API 

https://apim-ssg.portaldomain:9443/tenantname/api-management/1.0/apis/:apiUuid/assets

files (type=file) api.wsdl application/octet-stream (this is the file you select in postman to upload)

filename (type=text) sendEncaissement.wsdl Content-Disposition/form-data

The asset can be added without error.