Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

About

In this Quick Start Tutorial, you will learn about the Authentication Services and then make a call using the Extract Images Service. For the sake of instruction this tutorial will demonstrate two methods to interact with the API: curl and Postman. It is important to note that there are many alternatives to curl and Postman and the Vexcel API does not rely on any one URL handler. After working through this tutorial, you’ll be ready to review the rest of the API services and get started building your own applications and integrating Vexcel imagery into your workflows!

This tutorial will cover two steps:
Step 1 - Generate an Authentication Token using curl
Step 2 - Download a single discrete image using the Authentication Token.

Use of this tutorial requires a valid Vexcel API Subscription. Contact Vexcel Customer Service to inquire about credentials.


Step 1. Generate an Authentication Token

The authentication token will be used by every Vexcel API Service. As such, it is important to understand how to generate a token. Follow these steps to learn how to generate an authentication token using curl or Postman:

Before beginning, have your login-credentials ready; if you do not have login-credentials contact Vexcel Customer Service.

curl:

  1. Install curl

    1. Official Installation Instructions: https://curl.se/docs/install.html

  2. Open a command line interface window (e.g. Windows: Command Prompt, Mac: Terminal)

    1. Paste this curl command:

      curl --proxytunnel https://api.gic.org/auth/Login/ --data "username=username&password=password"
    2. update the values for the username and password parameters to reflect your login credentials.

    3. Press the Enter key

If your password contains the & character it is necessary add the flag --data-urlencode.

e.g. curl -p https://api.gic.org/auth/Login/ -d "username={username}" --data-urlencode "password={password}"

Postman:

  1. Log-in (or sign-up) to web.postman.co and open a new GET request tab.

  2. In the 'Enter request URL' box, paste:

    https://api.gic.org/auth/Login?username=username&password=password
    1. The ‘Query Params’ table will auto-populate, update the values for each parameter to match the table above; this will automatically update the URL.

  3. Click the ‘Send’ button

Results:

Success: {"token":"4c58a2327affca6ccde7fe6673c81e09a8d9654d391a21829c08ec9101482a062e6c68f0e551af6b11eae1467ea069d844a47082d9c97124fd1d20666774f4d923e1fb0874ff65a9ae58254cb8853066","expiration_date":"2021-05-08T17:44:32"}

  • Record your authentication token for future API use

  • Proceed to Step 2. to download an Image.

Failure: {"status": 701,"message": "Login Failed"}

  • Check your credentials and try again.

Failure: {"status": 111,"message": "Wrong parameters for this request"}

  • Wrong Parameters, there is an issue with your syntax. Carefully examine each character of the command and verify that there are no misplaced characters or erroneously included characters.

Some notes about the Authentication Token:

  • You will use the token in all future API calls

  • This token will be valid for 12 hours (24 hours for federated authenticated accounts), upon expiration a new one will need to be generated.

  • Detailed documentation on the Authentication Token Services including:

    • The Login Service will generate a new token (as demonstrated above) with additional examples in Python, and JavaScript

    • The Authenticate Service will report if an existing token has expired or not.

    • The Logout Service will terminate a token and its active session.


Step 2. Use the Authentication Token with the ExtractImages Service.

Now that we have an authentication token, we’re ready to put it to use and make our first call to the API. For this example, we’ll request an image from the ExtractImages service with a predefined set of parameters:

Parameter

Value

layer

bluesky-ultra-g

mode

one

orientation

NN

EPSG

4326

xcoordinate

-89.915411

ycoordinate

35.170619

zoom

0

token

{token}

width

1000

height

800

Feel free to modify these variables, using the ExtractImages documentation for more information.

curl:

  1. Open a basic text editor (e.g. Windows: Notepad, Mac: TextEdit):

    1. Paste this curl command:

      curl --proxytunnel https://api.gic.org/images/ExtractImages/bluesky-ultra-g/ --data "mode=one&orientation=NN&EPSG=4326&xcoordinate=-89.915411&ycoordinate=35.170619&zoom=0&width=1000&height=800&token=4c58a2327affca6ccde7fe6673c81e09a8d9654d391a21829c08ec9101482a062e6c68f0e551af6b11eae1467ea069d844a47082d9c97124fd1d20666774f4d923e1fb0874ff65a9ae58254cb8853066" --remote-name --remote-header-name
    2. Update the token parameter to reflect the authentication token you received in Step 1.

    3. Update any of the other parameters as you desire; doing so may result in errors and/or the downloading of a different image than exemplified.

  2. Open a command line interface window (e.g. Windows: Command Prompt, Mac: Terminal)

    1. Navigate to the directory in which you wish to download the image (e.g. C:\Users\Name\Downloads)

    2. Paste in the modified curl command and press Enter.

Postman:

  1. Log-in to web.postman.co and open a new GET request tab.

  2. In the 'Enter request URL' box, paste:

    https://api.gic.org/images/ExtractImages/bluesky-ultra-g?mode={mode}&orientation={orientation}&EPSG={EPSG}&xcoordinate={xcoordinate}&ycoordinate={ycoordinate}&zoom={zoom}&width={width}&height={height}&token={token}
    1. The ‘Query Params’ table will auto-populate, update the values for each parameter to match the table above; this will automatically update the URL.

  3. Click the ‘Send’ button

Results:

curl:

Success:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100 85812  100 85538  100   274  28512     91  0:00:03  0:00:03 --:--:-- 26403
curl: Saved to filename 'NN_20191002_175514_38222055B275B26_extract.jpg'

The image is located within the directory you navigated to prior to running the curl script:

Failure:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Remote filename has no length!
100   340  100    65  100   275     65    275  0:00:01 --:--:--  0:00:01   701
curl: (23) Failed writing body (0 != 65)
  • Wrong Parameters, there is an issue with your syntax. Carefully examine each character of the command and verify that there are no misplaced characters or erroneously included characters.

Postman:

Success:

No text output

Use the ‘Save Response’ button in the results section of the interface to download the image.

Failures:

{
    "status": 101,
    "message": "Error extracting image"
}
  • There is an issue with your URL; Carefully examine each character of the command and verify that there are no misplaced characters or erroneously included characters.

{
    "status": 403,
    "message": "Unauthorized"
}
  • Incorrect or expired authentication token. Review the token and regenerate a new token if necessary.

{
    "status": 600,
    "message": "No result available for this request"
}
  • There is an issue with one of the parameters which is causing the API to filter out all images. Review for a typo.


External Resources

  • No labels