BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
taninu
Fluorite | Level 6

Hi,

 

My company just upgrade SAS CI from MA to be CI360.

But the infrastructure of CI360 has been changed from on-promise to be cloud.

 

Now, I looking for some automation tools to upload account_identity data to CI360.

 

I have found the very useful link in Github: https://github.com/sassoftware/ci360-download-client-sas

of Python code but it's only for download data from CI360 not for upload data to CI360.

 

I'm not a Python programmer. So, I don't know how to create an API to upload data to CI360.

Does anyone have an example of Python? please share with me.

 

Thanks,

 

account_identity.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
NoahPowers
SAS Employee

I have a SAS macro that uses proc http and the JSON libname statement to upload data to the CI360 Hub that I could share if that would be helpful but I don't have a python version.

 

Noah

View solution in original post

6 REPLIES 6
NoahPowers
SAS Employee

I have a SAS macro that uses proc http and the JSON libname statement to upload data to the CI360 Hub that I could share if that would be helpful but I don't have a python version.

 

Noah

taninu
Fluorite | Level 6
Could you share with me please? I don't know why SAS Support (Thailand) told me that its not possible to upload data via API with SAS code (then they suggest to use 3rd party language like Python or java).
NoahPowers
SAS Employee

Hi,

 

Sorry about the delay.  I wanted to re-test my code to verify it still worked before I posted here. 

 

I have attached the SAS macros that I use to drive the API interactions.  You'll need to either submit each of the macros in your SAS session at the beginning or set up SASAUTOS so that SAS can automatically find saved local copies of the macros when you invoke them.

 

You'll need to get your tenant ID and secret key from your CI360 UI General Settings | Access Points and these get passed to the %gen_jwt macro to generate a JWT.  This JWT, your JSON descriptor file for the data and the actual data file itself are passed to the %upload_data2hub() macro.  You'll see that this macro uses the %call_proc_http() macro to invoke SAS proc http (and retry a few times if there is a failure). 

 

You'll upload your data with a call like the following:

 

/* This macro generates the JWT needed for authentication when uploading the data file */

%let DSC_AUTH_TOKEN = ;
%Gen_JWT(tenant_id = %str(<tenant id>),
                    secret_key = %str(<secret key>),
                    method = datastep,
                    out_macrovar_name = DSC_AUTH_TOKEN) ;

 

** When you have the JSON descriptor file to upload  **;
%Upload_Data2HUB(JWT=%superq(DSC_AUTH_TOKEN),
                                   DataDescriptorID =,
                                   DataDescriptorJsonFile =%str(<my descriptor json file>),
                                   File2Import =%str(<my file to import>),
                                   headerRowIncluded =%str(true),
                                  updateMode =upsert,
                                  contentName =%str(Test upload - can delete2)) ;

 

Please let me know if you run into any issues using these macros 🙂  Good Luck!

 

Noah

taninu
Fluorite | Level 6

Hi Noah,

 

Thank you very much. Your codes can run perfectly. Just need a few modifications (location of JsonOut.txt and json_imp.txt files).

SAS Thailand employee also provides me with another source code. But your codes are easier to understand.

 

ChrisMosa
SAS Employee

Import Data through the REST API
Before you send any REST API calls for this task, make sure that you review the prerequisites for importing data and set up access to the external API gateway.
TIP: The developer documentation for this REST API is available at Marketing Data API for SAS Customer Intelligence 360 (external).

 

Marketing Data API for SAS Customer Intelligence 360

Arno_F
SAS Employee

I created a simple Python script that can be used to upload/import data.

Sharing in case other people look for a similar solution and stumble accross this thread.

https://github.com/arnofkd/ci360_upload

This is a knowledge-sharing community for our customers. 
To get the most from your community experience, use these getting-started resources: 

Discussion stats
  • 6 replies
  • 2513 views
  • 6 likes
  • 4 in conversation