HTTP Call Closes Database
Hi All,
I'm having an issue with an HTTP call that I am trying to do. It keeps closing and reopening my database. It is a call to view a customers order history on my woocommerce store. If I use the URL in a button it opens the browser and views the correct page with no issues, but I would ideally like to have this view on my ninox clients account page.
let response := do as server http("GET", "https://mysite.com/wp-admin/user=" + number("Acc# Field"));
if response.error then
html("<h1>Error</h1><p>" + text(response.error) + "</p>");
alert(text(response.error))
else
html(response.result)
end;
Any advice on what I'm doing wrong?
Thanks
7 replies
-
Sorry I didn't paste teh correct code in the above. The one below is closing the database:
let t := this;let c := "http(method, url, header, body)";let rt := html("");let response := do as serverhttp("GET", "https://xsport.co.za/wp-admin/edit.php?post_status=all&post_type=shop_order&_customer_user=" + number(Acc))end;if response.error thenrt := html("<h1>Error</h1><p>" + text(response.error) + "</p>");alert(text(response.error))elsert := html(response.result)end;rtI took the "rt" off the end and it didn't close but also doesn't do anything else.
i then removed the "rt" from the entire code:
let t := this;let c := "http(method, url, header, body)";let response := do as serverhttp("GET", "https://xsport.co.za/wp-admin/edit.php?post_status=all&post_type=shop_order&_customer_user=" + number(Acc))end;if response.error thenhtml("<h1>Error</h1><p>" + text(response.error) + "</p>");alert(text(response.error))elsehtml(response.result)endStill got no response at all. So stripped it further to the following:
let t := this;let response := do as serverhttp("GET", "https://xsport.co.za/wp-admin/edit.php?post_status=all&post_type=shop_order&_customer_user=" + number(Acc))end;html("<h1>Error</h1><p>" + text(response.error) + "</p>")I get "Error" now but no text after it. SO I assume there is an error but I'm not getting anything more?
-
It will only display text(response.result) not html(response.result)
So it appears to be an issue when trying to view it as html
-
OK, so I've manged to get somewhere using a rich Text field and a button to send the info to it.
It is needing a user name and password to log in to view the backend. How do I automatically assign this so I don't have to do this manually. I thought using an api key would help but it isn'y doing it (formula from button below):
Orders := (let response := http("GET", "https://mysite.com/wp-admin/user=" + number(Acc), {Authorization: "API Key"}, null);html(response.result))Result:

-
Bumping this up as I'm still hoping there is a solution to this
-
Hi Clive,
A good opportunity to talk to our experts about this would be one of our API workshop on Mondays at 17:00 (in English).
You can register for the workshops here:
https://zoom.us/webinar/register/WN_tNnu2wwPSHWtwZQvj3egFwKind regards, Jörg
-
@Clive,
While I have not tried to use the wordpress api (yet)... This link points to the authentication needed
https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/
The secret sauce appears to be documented here.. Note the reference to "REST API".. that is what you are doing FROM / TO Ninox..
-
@Clive,
While I have not tried to use the wordpress api (yet)... This link points to the authentication needed
https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/
The secret sauce appears to be documented here.. Note the reference to "REST API".. that is what you are doing FROM / TO Ninox..
Content aside
- 5 yrs agoLast active
- 7Replies
- 1969Views

