Forum Discussion

msmsmsma's avatar
msmsmsma
Contributor
5 years ago

Process to download BULK API file with Informatica ETL/Linux box

Hi Community folks,

We have a requirement that we need to connect BULK API from Informatica ETL tool to load data into our Vertica Database.

We got all the information on community forum(like Client id,community id,access key etc...) Since we are new to this Khoros process, we are not sure how will we connect to this Bulk API and download the csv/Json file.

we tried to connect with GET and curl command but ended up with some errors. Can anyone please help us to provide any URL(other than BULK API documentation) which can help us to start with the process of downloading this file with Informatica ETL tool or at least from any of our Linux/Unix box.

Thanks in advance

Regards,

msmsmsma

  • import requests

    params = {'fromDate': startdate , # Set the start date in YYYYMMDD format
    'toDate': enddate }

    headers = {'client-id': client_id ,
    ###TODOplace the "Client ID" from LSI here
    'Accept': 'application/json'
    }
    url = '' ### URL can be obtained from sample curl command in lithium community page


    response = requests.get(
    url,
    params=params,
    auth =(access_token, ''),
    headers = headers # OPTIONAL: this could also be set to "application/json" to receive JSON results, or even left unset to receive CSV
    )
    #data = response.json()
    # Use "response.json()" incase you need json response (set 'Accept' header as mentioned above).
    print(response.headers)

    print(response.url)


    filename ='C:\<directory>\getdata.json' ### JSON file you can define where you want to put data

    with open(filename, 'wb') as fd:
    for chunk in response.iter_content(chunk_size=128):
    fd.write(chunk)
  • It gives the abilities of both clump preparing and ongoing handling mymedicalme.