cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Body Content in Post Snap

jsmith141
New Contributor III

Hi,

This is a very novice question, but I am having trouble with a post request snap. This is just to authenticate with the RingCentral platform to receive a token for API consumption. I am able to successfully retrieve an access token when calling the oauth/token endpoint in Postman. The issue arises when I try to move this post call into SnapLogic. The call requires certain parameters to be passed through the body and I am not sure how to duplicate this in SnapLogic post snap. Please see the screenshot of the Postman call Body tab below.

image

I have created a basic account in SnapLogic to store the username and password and my post snap references that account. I am also aware that the credentials of a basic account can be accessed using the “Account.Username” and Account.Password" of the respective referenced account within the snap.

I am just not sure how to build out the body section in the “x-www-form-urlencoded” format as shown in the screenshot? The error I get back when validating this post snap is just a 400: Bad Request.

Any insight/help that anyone could provide would be greatly appreciated. Please let me know if additional information is needed to provide assistance.

Thanks,
James

48 REPLIES 48

jsmith141
New Contributor III

Yes that is what happened. There is a missing piece that you don’t know about yet. Basically there is already an Authorization header that is required by RingCentral. Basically you have to take an app id and client secret concatenate the two the base64 encode the concatenated string and pass that as your Authorization header. Didn’t mean to leave that out earlier. Just didn’t realize it would be relevant until now.

ptaylor
Employee
Employee

I am also aware that the credentials of a basic account can be accessed using the “Account.Username” and Account.Password" of the respective referenced account within the snap.

I’m not sure what you mean by that. I’m not aware of any way to reference account fields through expressions in the snap.

Here’s a simple example with no account where the credentials come from the input document.
REST Post Echo Form URL Encoded_2022_03_09.slp (4.8 KB)

image

jsmith141
New Contributor III

Hi Ptaylor,

Thanks for your reply. please note that these containers should be all lowercase, “account.username” not “Account.Username”. This was a feature that I came across in the community. This is not the exact article that first came across this feature, but it references the same containers. Perhaps it is not available for all account types, or maybe it is in the process of being deprecated?

ddellsperger
Moderator
Moderator

I see that you have the extension specified in postman, is that required for your particular instance? If not, you can just use the OAuth2 Account within the REST snap pack as it has a grant type of password that you can use. It seems the only missing item at that point would be the ability to get the endpoint_id back from the request, if that’s an important step, it might be worth looking into the authorization_code flow in their documentation as that seems to not require the additional parameters in the body of the password grant flow. Again, this can be achieved with the REST OAuth2 Account. It also looks like they provide an OpenAPI specification, so you could use the appropriate account type for the Open API Snap to potentially achieve the same thing, assuming you’re able to get it working in the REST OAuth2 Account

Thanks for your response. That entry is actually not selected. The extension can be concatenated to the username( a phone number in this case) and passed with the username at that point. That is what I am currently doing in that snapshot you see above.

I am trying to get an OAuth2 account working in this case. The app in Ring Central does not provide a redirect URL, which if I understand correctly, rules out the option of authorization_code flow. I am trying to get it to authorize using the password flow but I get an error string in a new tab. See below.

{“response_map”: {“error_list”: [{“message”: “Request from platform.devtest.ringcentral.com returned an error (response code: 400, response: {\n "error" : "invalid_client",\n "errors" : [ {\n "errorCode" : "OAU-123",\n "message" : "Client authentication is required"\n } ],\n "error_description" : "Client authentication is required"\n})”}]}, “http_status_code”: 500}

Do you know what I might be missing? Again please forgive my lack of knowledge in this area.