Setting up cURL

cURL is a command line tool for making HTTP requests. Since Cloud Vision API is accessed over REST, we can use curl as a client for it. You can download cURL for your OS from here: https://curl.haxx.se/download.html. You can test the installation by running the following command: 

$ curl --version
curl 7.50.0 (x86_64-apple-darwin15.4.0) libcurl/7.50.0 OpenSSL/1.0.2h zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets

To test whether cURL is working as expected, run the following command:

$ curl https://reqres.in/api/users

This hits a public-hosted free mock REST API service named Req | Res (https://reqres.in/) and will return a bunch of users. Your output should look something like this:

//SNIPP SNIPP
{
"page" : 1,
"data" : [
{
"first_name" : "George",
"avatar" : "https://s3.amazonaws.com/uifaces/faces/twitter/calebogden/128.jpg",
"id" : 1,
"last_name" : "Bluth"
},
{
"id" : 2,
"avatar" : "https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg",
"last_name" : "Weaver",
"first_name" : "Janet"
},
{
"last_name" : "Wong",
"id" : 3,
"avatar" : "https://s3.amazonaws.com/uifaces/faces/twitter/olegpogodaev/128.jpg",
"first_name" : "Emma"
}
],
"total_pages" : 4,
"per_page" : 3,
"total" : 12
}
//SNIPP SNIPP

If you are not comfortable with command line-based interaction, you can use a tool such as Postman.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.124.21