BookmarkSubscribeRSS Feed

Getting Started with the Discover Download Program

Started ‎01-02-2024 by
Modified ‎01-02-2024 by
Views 324

In this blog, you'll learn how to use the Discover download program and the Marketing Gateway API to download data tables from SAS Customer Intelligence 360. We'll discuss how to obtain, configure, and use the program.

 

The Marketing Gateway API is one of the SAS Customer Intelligence 360 REST APIs. Using these endpoints, a program or user can download detail tables, discover base tables, metadata tables, and more. You can read more about the APIs in this introductory post or the REST API documentation.

 

To simplify using the Marketing Gateway API and processing the response, you can utilize the Discover Download program. This program can handle the required setup for the API, submit requests, and even process the response for you. The discover download program is available on Github either using python or a combination of python and SAS.

 

In this brief demo of the program's functionality, we will be using the python version, available here.

 

Once it is configured, the discover download program is a simple and more human-readable way to use the Marketing Gateway collection to download data tables.

 

The program generates the static JWT, submits the REST request on your behalf, and then processes the response automatically. In this example, we will download detail tables as CSV files.

 

I'll start by ensuring I have an access point and note its client secret, as well as the tenant ID and external gateway address of the tenant I'd like to use.

 

I start by cloning or downloading the program from GitHub. I'll add the tenant information to the config file in the dscconfig directory of the downloaded client. I copy and paste the tenant ID, client secret, and external gateway address into the corresponding variables tenantID, secret, and baseUrl.

 

I leave the agentName value the same.

 

Next, I'll open a command prompt and navigate to the extracted folder containing the discover.py file. I verify the client is set up with the command

 

python3 discover.py -h

 

This command specifies to run the discover download program using Python 3. The -h help option prints a list of the other options you can use to configure your download.

 

mr_1_help_option.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

If it is your first time running the discover download program, you may discover that you need to install some dependencies, which will be identified the first time you try to run the program. For example, you can download the required tqdm package using:

 

pip install tqdm

 

Once I've installed any required packages and verified that the discover program is working with the help option, I can run the program again with several options to download the detail tables.

 

Now I'll add several commands to specify information about the tables I want to download. I add the -st and -et options to specify the START and END datetimes. This range is from midnight on the first until midnight on the third of December, 2023. I enter the option -cf yes to specify I want the results as a CSV file. Lastly, I enter the -cd option, then “,”, to specify that I want to use a comma in my CSV file.

 

The full command with all options now reads:

 

python3 discover.py -m detail -st 2023-12-01T00 -et 2023-12-03T00 -cf yes -cd ","

I enter the command, and wait for it to finish running. Then I return to the discover program directory, and check the discover data warehouse (dscwh) directory for the CSV files from my download.

 

This is just a short introduction and preview to the functionality of the Marketing Gateway API and the Discover Download program. For more information about these resources including examples, see the program repository and the API documentation.

Version history
Last update:
‎01-02-2024 03:45 PM
Updated by:
Contributors

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags