Automation: Webhook response is not as expected

Hi.

I want to use Webhook for an API request. I know Apps Script is a good way to deal with APIs, but this time, I want a direct request from AppSheet to the API Server due to security issues.

 

I truly think it is possible to make the direct request, but the response of the server is not as expected. The error message from the API server says that the "userid" value is not in the body.

Here are the values I set for the webhook:

Preset: Custom
Url: https://api-server-url/token/create/30/s/
HTTP Verb: Post
HTTP Content Type: JSON
Body: {
"apikey": "xxxxxxxxxxxxx",
"userid": "xxxxx"
}

It is weird that the userid value, which I set in the body, seems to be not delivered properly. I tested the same request from my Python code, and it worked well.

My code looks like this:

import requests
import json

basic_send_url = 'https://api-server-url/token/create/30/s/'
sms_data={'apikey': 'xxxxxxxxxxxxx','userid': 'xxxxx',}

create_token_response = requests.post(basic_send_url, data=sms_data)
print(create_token_response.json())

 

This is the full request from the process for your reference.

{
"$type": "Nirvana.Data.TaskResultWebhook, V2API",
"Headers": {
"$type": "System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.String, mscorlib]], mscorlib"
},
"Payload": "{\"apikey\": \"xxxxxxxxxxxxx\",\"userid\": \"xxxxx\"}",
"Url": "https://api-server-url/token/create/30/s/",
"Verb": "Post",
"ContentType": "JSON",
"MimeType": "application/json",
"TimeoutSeconds": 180,
"MaxRetryCount": 3,
"AsyncExec": false,
"AppErrors": {
"$type": "Jeenee.DataTypes.AppErrors, Jeenee.DataTypes",
"RecordInfo": false,
"RecordWarning": true,
"AnnotateErrors": false,
"Errors": []
},
"TaskType": "Webhook",
"TaskName": "New step Task - 8"
}

 

I'm following the document of the API server, but I didn't find any problems yet. Please let me know if you need additional information.

I'd appreciate any opinions on this issue.

Thank you very much ๐Ÿ™‚

0 0 581
0 REPLIES 0
Top Labels in this Space