Forum Discussion

tavasjn24's avatar
3 years ago

Bulk Data API v2

Does anyone know why when I run my python3 bulk data api request I am getting a not found message. 

 

import requests
# Place the "Bulk API access token" from Community Analytics here
access_token = 'ACCESSTOKEN'
# Place the "Client ID" from Community Analytics here
client_id = 'CLIENTID'
response = requests.get(
    params={'fromDate': '20220411',  # Set the start date in YYYYMMDD format
            'toDate': '20220417'},   # Set the end date in YYYYMMDD format
    auth=(access_token, ''),
    headers={'client-id': client_id,  # TODO: place the "Client ID" from Community Analytics here
             'Accept': 'text/csv'}  # OPTIONAL: this could also be set to "application/json" to receive JSON results, or even left unset to receive CSV
)
# Use "response.json()" incase you need json response (set 'Accept' header as mentioned above).
data = response.text

print(data)
  • SudhakaraS's avatar
    SudhakaraS
    Khoros Alumni (Retired)

    " not found" message error response when community-id or client-id or auth token do not exist on the server-side, please check are you using the right client/auth token. Please try out the Curl call before trying with python script. 

    sample curl call:

    curl "https://api.lithium.com/lsi-data/v2/data/export/community/<community>.prod?fromDate=20220301&toDate=20220302" -H "client-id: ********=" -u "********:" -k -o lithosphere_prod