VMware Cloud Community
sadashivaMa
Contributor
Contributor

Request using Content Type: application/x-www-form-urlencoded is not working

Hi All,

we are trying to build vrops management pack using builder (1.1.2). The application we are building pack support Content Type: application/x-www-form-urlencoded request to get token .. using rest tool we could see expected output.

But from builder we see  response "Failed with error code 400: Bad Request"..

attached screenshots for references and log files.

Request to provide solution to above issue.

0 Kudos
11 Replies
marbogast
VMware Employee
VMware Employee

Hi @sadashivaMa 

Thanks for bringing this to our attention. We found a bug with how the MP Builder handles the x-www-form-urlencoded content type. The MP Builder is adding unnecessary escape characters before sending the HTTP request.

I'll provide another update when we have an ETA on the fix.

Best regards,
Mark

dmsbc19
Contributor
Contributor

Has there been any update on this? 

The bulk of our APIs require session generation, with passing of the credentials in the body via x-www-form-urlencoded, so as of now, we unfortunately cannot do anything with the MP builder as keen as we are to start. 

0 Kudos
marbogast
VMware Employee
VMware Employee

Hi @dmsbc19,

We have the fix nearly ready and should be publishing it within the next few days.

Best regards,

Mark

0 Kudos
marbogast
VMware Employee
VMware Employee

Hi @dmsbc19 and @sadashivaMa

The Management Pack Builder 1.1.3 OVA has been published to the marketplace page. This includes a fix for x-www-form-urlencoded. You can export your design from your current deployment and import it to the new VM.

If you prefer to upgrade your existing Management Pack Builder instance, we will be providing an upgrade binary later this week.

Best regards,

Mark

0 Kudos
dmsbc19
Contributor
Contributor

When using the pack builder;

{

"error": "invalid_grant",

"error_description": "Invalid user credentials"

}

When using the same request outside of the management pack builder - with Curl,Python,Powershell or Postman etc. with the same application/x-www-form-urlencoded body, it works fine.

0 Kudos
dmsbc19
Contributor
Contributor

It even works from curl if I log into the appliance directly via SSH and run the curl command that reflects the API call I am trying to make via the pack builder gui. There must be further logs to look at? 

0 Kudos
marbogast
VMware Employee
VMware Employee

Hi @dmsbc19,

Please double-check a few things:

- The HTTP Method is set to POST.

- Under advanced, a header is added with key "Content-Type" and value "application/x-www-form-urlencoded"

- Under advanced, the body is in query parameter format. Example:

key1=value&key2=value2

- If curl is doing any automatic character encoding of the body before sending the request, you'll probably need to do the same encoding manually before entering it into the Body field in MP Builder.

Attaching a couple screenshots for reference. The request log in the UI is the best log to look at. If the tips above don't help, please send the body of your request so we can verify the format. We'd also be happy to jump on a call to take a look directly. You can reach me directly at mark.arbogast@broadcom.com.

0 Kudos
sadashivaMa
Contributor
Contributor

Hi Mark,

Thank You. using new release version 1.1.3 had fixed the issue.

I tried to import developed build file into MB GUI and configured the environment and new release of the product and have to overwrite existing url for session ( as this got changed in new release).

Saw one concern after fixing sessions noticed event tab definition are lost ( its difficult to track what was configured ) and definitions have mandatory dependency on objects/instance should exists in connected env.

 PFA for ref screenshots.

0 Kudos
marbogast
VMware Employee
VMware Employee

Hi @sadashivaMa,

Glad to hear you were able to get past the x-www-form-urlencoded issue with 1.1.3.

Thanks for the detailed write-up. Regarding item 1: you can use a custom configuration field to avoid having to manually update the version in every request for v2, v3, etc. To do this, create the new config field then copy and paste the Usage variable into each request's path. Then in future API versions you would just need to update the "Value" and "Default" of the API version in one place. Here's a quick demo: https://recordit.co/PhnYGX5BkM

Regarding item 2:

Sorry that the original response data was lost when you re-deployed the VM - that is frustrating. We remove all environment / customer-specific data (e.g., responses) from the exported design JSON so that MP designs can be shared safely. For future MP Builder versions we'll investigate an option to include response data with the design.

Also, we normally suggest upgrading in-place vs. re-deploying a new VM, which will preserve the response data. For future releases we will provide the in-place upgrade tarball at the same time as the new OVA. 

Best regards,

Mark

0 Kudos
deanphelps
Contributor
Contributor

My marketplace page only displays versions 1.0 & 1.1.2 for download.  Has 1.1.3 been rescinded? 

IdahoDean
0 Kudos
marbogast
VMware Employee
VMware Employee

Hi @deanphelps,

v1.1.3 should still be available, but I'm also not seeing it on the marketplace. We will look to get it re-published but it may take a couple weeks. Feel free to reach out to us directly at mp-builder-dev.pdl@broadcom.com and we can find another way to provide the build in the meantime.

Best regards,
Mark

0 Kudos