Invoking the API - please help

raketa
Participant V

Configured everything as described in this article https://help.appsheet.com/en/articles/1979979-invoking-the-api
In Audit Log Details shows information:2X_4_4305ee6cdd821becaa3d6f136f52e41de601061b.jpeg
Please help.

0 17 954
17 REPLIES 17

LeventK
Participant V

@raketa
How was your payload?

what is it about?

@raketa
Iโ€™m asking about yout HTTP Body content for the API call.

{
โ€œActionโ€: โ€œAddโ€,
โ€œRowsโ€: [
{
โ€œpost_idโ€: โ€œ<<[post_id]>>โ€,
โ€œpost_titleโ€: โ€œ<<[post_title]>>โ€
}
]
}

@raketa
Your HTTP Body is malformed

{
	"Action": "Add",
	"Properties": {
		"Locale": "en-US",
		"Location": "47.623098, -122.330184",
		"Timezone": "Pacific Standard Time"
	},
	"Rows": [
		{
			"post_id": "<<[post_id]>>",
			"post_title": "<<[post_title]>>"
		}
	]
}

again
2X_3_38d5229519e4f77389e3a4fbbf12b1f206dd1063.png

You shall check your API endpoint and HTTP headers as well. Status Code indicates that one of these is malformed or there are missing params

what is the endpoint API
and HTTP headers?
my settings


raketa
Participant V

Here the inquiry remained unanswered, please help.

@raketa
As you may realize well, majority of the world and the people are in Christmas Holiday, so you shall understand some delays.
I have before replied you already and mentioned above that your payload is malformed. I have asked you what API endpoint are you using and what is your HTTP header and you had responded with a couple of screenshots which does not give any positive reply as well. I repeat my questions and additionally:
1.) What is the use of the body template here? And whatโ€™s its content?


2.) From the additional 2 images I havenโ€™t understood what you are trying to show. Are you trying to invoke AppSheet API thru a 3rd party webhook service like WordPress?

  1. This body template:
    {
    โ€œActionโ€: โ€œAddโ€,
    โ€œPropertiesโ€: {
    โ€œLocaleโ€: โ€œen-USโ€,
    โ€œLocationโ€: โ€œ47.623098, -122.330184โ€,
    โ€œTimezoneโ€: โ€œPacific Standard Timeโ€
    },
    โ€œRowsโ€: [
    {
    โ€œpost_idโ€: โ€œ<<[post_id]>>โ€,
    โ€œpost_titleโ€: โ€œ<<[post_title]>>โ€
    }
    ]
    }
  2. Yes, invoke AppSheet API thru a 3rd party webhook service WordPress.

I understand everyone celebrates Christmas, with which I want to congratulate you, but the problem is more important).

Yes I do understand @raketa, however do apologize but nothing is more important than the family especially with the special times.


From this image that you have posted, it can be seen that [post_title] parameter is a sub-key value of an array called {post} and you are trying to retrieve a child parameter of a parent parameter with directly specifying the child parameter in your JSON payload. In normal conditions, you should be able to retrieve the value via [post].[post_title] but I have no any information about the 3rd party service that you are using.


You can alter your Rows parameter of your payload like this:

โ€œRowsโ€: [
	{
	โ€œpost_idโ€: โ€œ<<[post_id]>>โ€,
	โ€œpostโ€: {
		โ€œpost_titleโ€: โ€œ<<[post_title]>>โ€
		}
	}
]

TDhers
Participant V

Thank you for your patience and willingness to help out other fellow Appsheet users Levent.
This is much much appreciated days in and days out from the Appsheet team here and everywhere else you contribute.
Hi Raketa, I hope you appreciate Leventโ€™s willingness to help you out with your API call issue. He is not an Appsheet employee but another fellow Appsheet users (albeit extremely knowledgeable expert one) who is trying to help you out.
You are more than welcomed to send mail to Support@Appsheet.com if you need further support from the Appsheet team though I think Levent has already given you a path to success above.
Thierry

Your application contains a workflow rule called โ€œะ”ะพะฑะฐะฒะปะตะฝะฝั‹ะต ัั‚ั€ะฐะฝะธั†ั‹-1 2โ€ that invokes a webhook action called โ€œadd_page_wpโ€ which invokes the REST API. I searched Audit History for the past 2 days and I see no sign that this workflow rule has been invoked. I assume that this workflow rule plays no part in the error you are reporting.

Based on your response to Levent, it appears you are attempting to invoke the AppSheet REST API from WordPress. I looked at the most recent attempt to invoke the REST API in the Audit History. The record with UTC timestamp 12/26/2019 5:34:10 PM reported that the โ€œActionโ€ parameter was missing. In fact, the Action, the other REST API parameter values, and the row data all seemed to be missing from the REST API Body.

You have posted a screen shot that starts with the heading โ€œSent values:โ€. Can you explain what that is?

If you want to invoke the REST API from a third party application like WordPress, that system must provide a way to construct a POST body that matches the format expected by the AppSheet REST API. Does WordPress provide that? If so, does it allow you to see the exact format of the POST Body it is sending. It appears that the Body being sent to AppSheet does not conform to the expected Body format.

I understand you, maybe this will help?
I use this plugin for WP, but have not used this functionality yet. https://ironikus.com/docs/knowledge-base/data-mapping/
Here is a more detailed screenshot:

I looked at the WP Webhook documentation briefly. Frankly I found it confusing so I am not sure I can provide much guidance.

It does appear that WP Webhook Pro is capable of invoking a Zapier trigger. If so, you should be able to use such a trigger to invoke the AppSheet REST API in your Zap. In your Zap, you could map data that comes in via the WP Webhook Pro trigger into the appropriate fields in the AppSheet REST API call.

Top Labels in this Space