VMware Cloud Community
Dimibm
Contributor
Contributor

Can not get success when setting MIME tye whithin HTTP GET when using vco REST API

Hi:

   When I set accept header in http, server return bad request. If I don't set accept header, it will be success.

send: 'GET /vco/api/workflows HTTP/1.1\r\nAccept-Encoding: identity\r\nAuthorization: Basic dmNvYWRtaW46dmNvYWRtaW4=\n\r\nHost: 9.111.254.58:8281\r\nConnection: close\r\nAccept: application/json;v=5.1.1\r\nUser-Agent: Python-urllib/2.6\r\n\r\n'

reply: 'HTTP/1.1 400 Bad Request\r\n'

Anybody can tell me where is the worng?

Reply
0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee

To rule out the possibility for some Python-specific issue, could you check if you get the same error make the same API call with some other client, for example with curl or with some browser REST client?

Also, could you check what happens if you omit the version number in accept header -  'Accept: application/json' ? Or if you use a different type like application/xml ?

Reply
0 Kudos
Dimibm
Contributor
Contributor

I captured web browser's request and found it has Accept-Encoding header.

So I just add it into Python request. It works now.

But I do not know why Accept-Encoding have to addin

Reply
0 Kudos