-
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
- 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'
- 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"}}'
- 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.