Skip to content

Instantly share code, notes, and snippets.

@rssnyder
Created March 30, 2026 20:46
Show Gist options
  • Select an option

  • Save rssnyder/38af3480231d83c323d25e5f964f9220 to your computer and use it in GitHub Desktop.

Select an option

Save rssnyder/38af3480231d83c323d25e5f964f9220 to your computer and use it in GitHub Desktop.
upload 3party data into harness ccm via api
  1. Here is a python implementation of the below process

  2. Call GET signed url. This is needed for any upload.

curl 'https://app.harness.io/gateway/ccm/api/externaldata/signedurl?providerId=<provider id>&accountIdentifier=<account id>&invoicePeriod=20250401-20250501&objectName=<csv file>.csv' \
  -H 'x-api-key: <api key>' \
  -H 'content-type: application/json'

This will give you a signed URL

  1. Use the above signedurl to perform a PUT for upload. The file then goes in GCS.
curl '<url from response>' \
  -X 'PUT' \
  -H 'Content-Type: text/csv'
  1. use filesinfo CRUD api to mark the status of file uploads.
curl 'https://app.harness.io/gateway/ccm/api/externaldata/filesinfo?accountIdentifier=<account id>' \
  -H 'x-api-key: <api key>' \
  -H 'content-type: application/json' \
  --data-raw '{"externalDataFiles":{"accountId":"<account id>","name":"<csv file>.csv","fileExtension":"CSV","signedUrlUsed":true,"md5":"<md5 of csv>","providerId":"<provider id>","providerName":"<provider name>","cloudStoragePath":"<presigned url>","uploadStatus":"COMPLETE","invoiceMonth":"20250401-20250501"}}'
  1. Once all the files for a invoice periods are done, trigger actual ingestion using this api
curl 'https://app.harness.io/gateway/ccm/api/externaldata/dataingestion?accountIdentifier=<account id>' \
  -H 'x-api-key: <api key>' \
  -H 'content-type: application/json' \
  --data-raw '{"accountId":"<account id>","invoicePeriod":["20250401-20250501"],"providerId":"<provider id>"}'

providerId - comes when we create a provider in the UI. An API can be used as well to automate provider creation. invoice-period - period for which api costs we are calculating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment