Jump to content
Reekod

http API best practice

Recommended Posts

Reekod
Posted (edited)

Hi there, 

I stopped all scripting activity since 2012 i really lost my skill for now. That's why i need you to give me a little help to understand the new autoit version,

 

local $test = "https://api.coinmarketcap.com/v1/ticker/ubiq/"

ConsoleWrite ($test)

As you can see the result is only the text format of URL is returned.

>Running AU3Check (3.3.14.3)  from:C:\Program Files (x86)\AutoIt3  input:D:\_G\dev\_Portfolio\testAPI.au3
+>19:43:33 AU3Check ended.rc:0
>Running:(3.3.14.3):C:\Program Files (x86)\AutoIt3\autoit3.exe "D:\_G\dev\_Portfolio\testAPI.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
https://api.coinmarketcap.com/v1/ticker/ubiq/+>19:43:34 AutoIt3.exe ended.rc:0
+>19:43:34 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 0.7835

Actually the winhttp.au3 is no more available in the new version and i would like to put in a variable the result of the API http request below. 

i try to write this result in the console

[
    {
        "id": "ubiq", 
        "name": "Ubiq", 
        "symbol": "UBQ", 
        "rank": "117", 
        "price_usd": "2.92355", 
        "price_btc": "0.00026639", 
        "24h_volume_usd": "4441830.0", 
        "market_cap_usd": "116551310.0", 
        "available_supply": "39866365.0", 
        "total_supply": "39866365.0", 
        "max_supply": null, 
        "percent_change_1h": "1.33", 
        "percent_change_24h": "-1.3", 
        "percent_change_7d": "16.71", 
        "last_updated": "1520349243"
    }
]

is someone can give me an, advice of which function is the best way to  do that.

Regards

Ree

Edited by Reekod

Share this post


Link to post
Share on other sites
Reekod
Posted (edited)

Got it with this 

local $test = 'https://api.coinmarketcap.com/v1/ticker/ubiq/'

local $1 = InetRead ( $test )

ConsoleWrite ($1)

Console return ok

>Running:(3.3.14.3):C:\Program Files (x86)\AutoIt3\autoit3.exe "D:\_G\dev\_Portfolio\testAPI.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
[
    {
        "id": "ubiq", 
        "name": "Ubiq", 
        "symbol": "UBQ", 
        "rank": "116", 
        "price_usd": "2.86572", 
        "price_btc": "0.00026482", 
        "24h_volume_usd": "4309480.0", 
        "market_cap_usd": "114252582.0", 
        "available_supply": "39868718.0", 
        "total_supply": "39868718.0", 
        "max_supply": null, 
        "percent_change_1h": "0.35", 
        "percent_change_24h": "-4.1", 
        "percent_change_7d": "14.76", 
        "last_updated": "1520362743"
    }
]+>19:59:10 AutoIt3.exe ended.rc:0
+>19:59:10 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 0.9772

 

 

Edited by Reekod

Share this post


Link to post
Share on other sites
Andreik

Try this

MsgBox(0,'',BinaryToString(InetRead('https://api.coinmarketcap.com/v1/ticker/ubiq/')))

 


When the words fail... music speaks

Share this post


Link to post
Share on other sites
Reekod

thx for confirm that Inetread is the right func to use for

regards

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×