On this page, a quick example on how to start with the wrapper. More details explanation are available in the main file or one the datanalyst.info website
First you should create an Adobe IO account and create a Project that connect to 2 API :
- Adobe Experience Platform API
- CJA API
At the time of the writting, permission to both API are required in your project for the token to be generated. CJA API is currently only supporting the JWT connection type.
When you create your Adobe IO account, you can either let Adobe generate a certificate for you or you set a certificate, keep the key nearby because you will need it. In case you want to generate your own certificate, you can follow this tutorial
You have a documentation available on the official Adobe website
You can directly install the library from the command line:
pip install cjapy
or
python -m pip install --upgrade git+<https://github.com/pitchmuc/cjapy.git#egg=cjapy>
Starting with the wrapper, you can import it and create a template for the JSON file that will store your credential to your Adobe IO account.
import cjapy
cjapy.createConfigFile()
This will create a JSON and you will need to fill it with the information available in your adobe io account.
NOTE: Starting version 0.2.0 the createConfigFile
will by default generate a config file supporting Oauth Server to Server integration.
Once this is done, you can import the configuration file. I would recommend to store the config file and the key in the folder that you are using, however, the element will work if you are using correct path.
import cjapy
cjapy.importConfigFile('myconfig.json')
NOTE: Starting version 0.2.0 the importConfigFile
will detect the type of authentication based on the parameter. If scopes
is provided, Oauth Server to Server will be used.
When you want to connect to the Analytics API from a server application, you may want to use the configure
method and passing the element directly.
You can see more details on that connection method on the authentication without config json page
Once all of these setup steps are completed, you can instantiate the CJA
class.
The instance of the CJA class will establish the connection to the CJA API endpoints and provide all of the methods available on the API.
import cjapy
cjapy.importConfigFile('myconfig.json')
cja = cjapy.CJA()
Once you have the instance created, you can use the different methods available to them. Don't hesitate to use the help() function in order to have more details on the different possible parameters. Example :
filters = cja.getFilters()
or
myreport = cja.getReport('myRequest.json')
You have more information on the method available on the CJA class in that documentation: CJA class