HTTP Call Closes Database
Ninox Profile

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

Ninox Profile

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 server

http("GET", "https://xsport.co.za/wp-admin/edit.php?post_status=all&post_type=shop_order&_customer_user=" + number(Acc))

end;

if response.error then

rt := html("<h1>Error</h1><p>" + text(response.error) + "</p>");

alert(text(response.error))

else

rt := html(response.result)

end;

rt

I 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 server

http("GET", "https://xsport.co.za/wp-admin/edit.php?post_status=all&post_type=shop_order&_customer_user=" + number(Acc))

end;

if response.error then

html("<h1>Error</h1><p>" + text(response.error) + "</p>");

alert(text(response.error))

else

html(response.result)

end

Still got no response at all. So stripped it further to the following:

let t := this;

let response := do as server

http("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?

Ninox Profile

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

Ninox Profile

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:

Screenshot

Ninox Profile

Bumping this up as I'm still hoping there is a solution to this

Reply