Hi, I'm trying to import a new API proxy using this manual. However, when I try to run the next curl
curl -X POST -u "{email}:{password}" "https://api.enterprise.apigee.com/v1/organizations/{myorganization}/apis?action=import&name={proxyname}" -F "file=@proxy.zip" -i
I get the next response back
HTTP/1.1 400 Bad Request Content-Type: application/json Date: Tue, 05 Dec 2017 18:17:44 GMT Server: Apigee LB Content-Length: 133 Connection: keep-alive { "code" : "repository.cassandra.UnableToReadApiProxy", "message" : "Unable to read/find APIProxy contents", "contexts" : [ ] }
If I try to run the same request but using Postman - it successfully works. So it's not a problem with my bundle file or proxy that I want to update.
What could be the reason why I cannot use curl?
Welcome to the community ! Did you pass the Content-Type header as multipart/form-data ?
Documentation says: "In the following cURL example, Content-Type is automatically set to multipart/form-data
", but yes, I tried to pass it just in case and this didn't help 😞
Sorry for the delayed response. I believe your zip is not in the correct format. Please make sure that you zip includes the apiproxy folder
proxy.zip
|
- apiproxy
|
- policies
- proxies
- targets
No, nothing wrong with my bundle zip file. As I mentioned above I may do this request using Postman or may upload this zip using ApiGee UI and it successfully work! So, not a problem with my bundle file for sure 🙂
Thanks for the clarification. I tried the exact same command you shared and it worked. For example
curl -X POST -u "username:password" "https://api.enterprise.apigee.com/v1/organizations/{org}/apis?action=import&name=testProxy" -F "file=@testProxy.zip" -i
And it worked for me.
However when I remove the "@" from the file param, I get the same error what you see
HTTP/1.1 400 Bad Request Content-Type: application/json Date: Thu, 14 Dec 2017 16:58:12 GMT Server: Apigee LB Content-Length: 133 Connection: keep-alive { "code" : "repository.cassandra.UnableToReadApiProxy", "message" : "Unable to read/find APIProxy contents", "contexts" : [ ] }
So am assuming you are not passing the "@" for the file param. Can you confirm you are passing that and its failing even after that
@Aleksey Pshenichnov , I face similar problems at times when the bundle is created manually and zipped.
I work around this by trying to upload the bundle via management ui in an engineering server, if it uploads via proxy bundle upload a new revision then the bundle is validated and it should work via the management api also without problems.
Regards,
Sreenivas S P
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |