Previous Thread
Next Thread
Print Thread
xcall HTTP #37119 19 Feb 24 08:44 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
Hi,

I am using xcall HTTP with a web API. The API uses bearer authorization which requires adding a custom header. It is working great for POST requests (using XHTTPF_HDRBODY), but there is a GET request I need to perform with the authorization header as well. Would it be possible to expand XHTTPF_HDRBODY to work for GET requests as well or add some other capability for adding custom headers?

Thanks,
John Andreasen

Re: xcall HTTP [Re: John Andreasen] #37120 19 Feb 24 08:55 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
I think the XHTTPF_REQGETX opflag allows you to do that, as described in Customizing GET Headers. Or did that not work?

Re: xcall HTTP [Re: John Andreasen] #37121 19 Feb 24 08:59 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
That works! Thanks for the tip as I guess I missed that in the docs (even though it is an obvious link at the bottom of the page.)

Re: xcall HTTP [Re: John Andreasen] #37122 19 Feb 24 10:10 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
Great! I'd call it a win for the documentation department, except they obviously didn't make it easy enough to find!

I think I'll have Ty add a "see also XHTTPF_REQGETX" message into the XHTTPF_REQGET entry in the flags table.

Re: xcall HTTP [Re: John Andreasen] #37123 19 Feb 24 11:04 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
Yes, definitely no fault of the documentation department. Not a bad idea to have the note though. Thanks again

Re: xcall HTTP [Re: John Andreasen] #37124 19 Feb 24 11:05 PM
Joined: Mar 2005
Posts: 494
Ty Griffin Offline
Member
Offline
Member
Joined: Mar 2005
Posts: 494
The documentation has been updated, John. You won't see it right away, but it will be in the next published version of the A-Shell Reference.

Re: xcall HTTP [Re: John Andreasen] #37127 21 Feb 24 07:31 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
OK, thank you Ty.

So, it looks like I have a need that I don't think is currently handled. There is one request I need to make is a DELETE operation. If it is not currently supported, would it be possible to add?

Thanks,
John Andreasen

Re: xcall HTTP [Re: John Andreasen] #37129 21 Feb 24 08:50 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
The documentation isn't very clear on this, and I don't have a handy example, but I think you can convert the XHTTPF_REQGETX operation to DELETE by specifying a pseudo-header Verb, i.e. "Verb : DELETE" in your customized headers. In theory that should cause it to switch operations from GET to DELETE, but leave everything else the same.

Re: xcall HTTP [Re: John Andreasen] #37130 21 Feb 24 09:07 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
OK, thanks. I will try it.

Re: xcall HTTP [Re: John Andreasen] #37218 19 Mar 24 08:32 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
OK, I have another question. I am trying to do a HTTP PUT operation, but keep being returned a status of -4 (misc param error). The request looks like this.
Code
XCALL HTTP, XHTTPOP_REQ, sts, XHTTPF_SSL OR XHTTPF_REQPUT OR XHTTPF_DEBUG, url$, "", response$

The url string is https://api.emergepay-sandbox.charg...actions/3824cba6531a455e81b30bfab1af82ac
I have a much more complicated POST request working fine, but am having issues with PUT for some reason. Any suggestions are appricated.

Thanks,
John

Re: xcall HTTP [Re: John Andreasen] #37220 19 Mar 24 09:27 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
I'm not sure how to explain this but the XHTTPF_REQPUT option seems to have gotten broken somewhere along the line. (Obviously it's not a very common option!) I'll post an update this afternoon...

Re: xcall HTTP [Re: John Andreasen] #37221 19 Mar 24 09:28 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
OK, thanks

Re: xcall HTTP [Re: John Andreasen] #37222 19 Mar 24 10:54 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
Ok, try your program again with one of these...

libashnet.so.1.14.192.el7.tz
ashnet-1.14.192-w32.zip

Re: xcall HTTP [Re: John Andreasen] #37225 22 Mar 24 08:35 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
Hi Jack,

This seems to resolve the issue. Thanks. We did want to verify that the libashnet library is a 32 bit build. I had to link in /usr/lib, not /usr/lib64 for it to work.

Re: xcall HTTP [Re: John Andreasen] #37226 22 Mar 24 08:42 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
Hi John -

Glad to hear it. And regarding the 32/64 bit confusion, for the Linux libraries, we've adopted the convention of tacking -x86_64 to the name of the 64 bit versions; otherwise it's safe to assume they're 32 bit. (You can also use the Linux file command to check the architecture of an executable or library.) The library architecture needs to match the executable architecture.

For some reason I was under the impression that you were still using the 32 bit ashell version which is why I only released that version here. But eventually the other versions will start getting posted. (Or, just let me know if you need a version that hasn't been posted.)

Re: xcall HTTP [Re: John Andreasen] #37227 22 Mar 24 09:00 PM
Joined: Aug 2016
Posts: 329
J
John Andreasen Offline OP
Member
OP Offline
Member
J
Joined: Aug 2016
Posts: 329
OK, thanks for the info. I was thinking that all the 7.0 versions were 64 bit, but I guess that assumption is wrong as I am running 7.0.1756.9 EL7 and it does not appear to be 64 bit. Also, thanks for the tip about the file command. I did not realize it would display the architecture.


Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3