locked
Web Activity Post method Body format RRS feed

  • Question

  • I am trying to do a REST API post using the ADFv2 Web Activity and I can't get the format correct in the BODY of the activity.  I have the call working in both CURL and Postman, but the Web Activity won't recognize the body in any of the formats I have tried. 

    I have tried what's documented here but this doesn't work.  I get an error saying "The request body must contain the following parameter: 'grant_type'."

    Example format I used.

    {
            "grant_type": "client_credentials",

    ....

    }

    I've tried changing the header Content-Type parameter (json vs x-www-form-urlencoded), I've tried the @JSON function, I've tried just about everything it seems but it still complains about my parameter missing.  Any ideas?

    Thursday, January 24, 2019 6:29 PM

Answers

  • For anyone having the same issue, I was finally able to get it to work by doing the following:

    Add a header by clicking  +New

    Content-Type | application/x-www-form-urlencoded

    Then in the body I used the format:

    myparameter=myvalue&myparameter2=myvalue2&myparameter3=myvalue3

    I also had to encode the body string for http, and used no quotes or brackets around the value.  I hope that helps for future searchers!

    • Marked as answer by AzureFrank Thursday, January 24, 2019 8:23 PM
    Thursday, January 24, 2019 7:47 PM

All replies

  • For anyone having the same issue, I was finally able to get it to work by doing the following:

    Add a header by clicking  +New

    Content-Type | application/x-www-form-urlencoded

    Then in the body I used the format:

    myparameter=myvalue&myparameter2=myvalue2&myparameter3=myvalue3

    I also had to encode the body string for http, and used no quotes or brackets around the value.  I hope that helps for future searchers!

    • Marked as answer by AzureFrank Thursday, January 24, 2019 8:23 PM
    Thursday, January 24, 2019 7:47 PM
  • Glad to hear that your issue is resolved. Appreciate for sharing the resolution, this would certainly benefit other community members.

    Friday, January 25, 2019 3:53 AM
  • Hi,

    Please check with the below configuration : 

     URL : https://login.microsoftonline.com/{tenant_id}/oauth2/token
    Method  :  POST

    Headers : 
    grant_type = client_credentials
    Content-Type = application/x-www-form-urlencoded

    Body  :

    grant_type=client_credentials&client_id=client_id}&client_secret=client_secret}&resource=https://management.azure.com/

    This worked for me...

    Thursday, December 5, 2019 9:49 AM