Can this type of API access be done with AHK?

Get help with using AutoHotkey and its commands and hotkeys
AHKStudent
Posts: 1055
Joined: 05 May 2018, 12:23

Can this type of API access be done with AHK?

04 Jan 2021, 11:18

I will link to the site and post in the relevant info here. This is what they want in order to connect with their API. If this could be done with AHK and you did something like this please share some pointers, thanks

https://docs.pro.coinbase.com/#creating-a-request

Creating a Request
All REST requests must contain the following headers:

CB-ACCESS-KEY The api key as a string.
CB-ACCESS-SIGN The base64-encoded signature (see Signing a Message).
CB-ACCESS-TIMESTAMP A timestamp for your request.
CB-ACCESS-PASSPHRASE The passphrase you specified when creating the API key.
All request bodies should have content type application/json and be valid JSON. (this I know AHK is no problem)

The CB-ACCESS-SIGN header is generated by creating a sha256 HMAC using the base64-decoded secret key on the prehash string timestamp + method + requestPath + body (where + represents string concatenation) and base64-encode the output. The timestamp value is the same as the CB-ACCESS-TIMESTAMP header.

The body is the request body string or omitted if there is no request body (typically for GET requests).

The method should be UPPER CASE.

Remember to first base64-decode the alphanumeric secret string (resulting in 64 bytes) before using it as the key for HMAC. Also, base64-encode the digest output before sending in the header.
Selecting a Timestamp
The CB-ACCESS-TIMESTAMP header MUST be number of seconds since Unix Epoch in UTC. Decimal values are allowed.

Your timestamp must be within 30 seconds of the api service time or your request will be considered expired and rejected. We recommend using the time endpoint to query for the API server time if you believe there many be time skew between your server and the API servers.
User avatar
Jovannb
Posts: 256
Joined: 17 Jun 2014, 02:44
Location: Austria

Re: Can this type of API access be done with AHK?

04 Jan 2021, 11:24

Hi,

I'd a similar challenge, requesting data via WSDL from a server.
I did that with help of curl.exe - it works like a charm.

For your "Coinbase-Pro", there are examples for Curl-Calls
https://documenter.getpostman.com/view/8801195/SzzrZEXi?version=latest

You've to call that Curl-calls via AHK and gather results via files.

regards

JB
AHK: 1.1.33.01 Ansi, 32-Bit; Win10 (2004, 19041.685) 64 bit, german
User avatar
JoeWinograd
Posts: 1652
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Can this type of API access be done with AHK?

04 Jan 2021, 12:21

AHKStudent wrote:All REST requests
Hi AHKStudent,
Here's a thread where I received great help from the forum to get a REST API working:

https://autohotkey.com/boards/viewtopic.php?f=5&t=49478

Maybe some of the comments and code there will be helpful with the REST API that you're working on. Regards, Joe
AHKStudent
Posts: 1055
Joined: 05 May 2018, 12:23

Re: Can this type of API access be done with AHK?

04 Jan 2021, 13:38

JoeWinograd wrote:
04 Jan 2021, 12:21
AHKStudent wrote:All REST requests
Hi AHKStudent,
Here's a thread where I received great help from the forum to get a REST API working:

https://autohotkey.com/boards/viewtopic.php?f=5&t=49478

Maybe some of the comments and code there will be helpful with the REST API that you're working on. Regards, Joe
thanks, ill check

Return to “Ask For Help”

Who is online

Users browsing this forum: ark, Bing [Bot], Spawnova and 41 guests