Here’s a sample GET request that generates a chargeback report for the tenant named europe that has two namespaces, finance and hr. The report covers one day. The report is written in CSV format to a file named FinanceStats-2020-01-31.txt. The request is made using a tenant-level user account that includes the administrator role.
Request with cURL command line
curl -k -i -H "Accept: text/csv" -H "Authorization: HCP bGdyZWVu:a3b9c163f6c520407ff34cfdb83ca5c6" "https://finance.hcp.example.com:9090/mapi/tenants/finance/ chargebackReport?start=2020-01-31T00:00:00-0500 &end=2020-01-31T13:59:59-0500&granularity=day" > FinanceStats-2020-01-31.txt
Request in Python using PycURL
import pycurl filehandle = open("FinanceStats-2020-01-31.txt", 'wb') curl = pycurl.Curl() curl.setopt(pycurl.HTTPHEADER, ["Accept: text/csv", "Authorization: HCP \ bGdyZWVu:a3b9c163f6c520407ff34cfdb83ca5c6"]) curl.setopt(pycurl.URL, "https://finance.hcp.example.com:9090/mapi/tenants/finance/" + "chargebackReport?start=2020-01-31T00:00:00-0500" + "&end=2020-01-31T13:59:59-0500&granularity=day") curl.setopt(pycurl.SSL_VERIFYPEER, 0) curl.setopt(pycurl.SSL_VERIFYHOST, 0) curl.setopt(pycurl.WRITEFUNCTION, filehandle.write) curl.perform() print curl.getinfo(pycurl.RESPONSE_CODE) curl.close() filehandle.close()
Request headers
GET /mapi/tenants/finance/chargebackReport?start=2017-02-17T00:00:00-0500&end=2020-01-31T23:59:59-0500&granularity=day HTTP/1.1 Host: finance.hcp.example.com:9090 Authorization: HCP bGdyZWVu:a3b9c163f6c520407ff34cfdb83ca5c6 Accept: text/csv
Response headers
HTTP/1.1 200 OK Content-Type: text/csv X-HCP-SoftwareVersion: 9.0.0.2 Content-Length: 767
Response body
systemName,tenantName,namespaceName,startTime,endTime,objectCount,ingestedVolume,storageCapacityUsed,bytesIn,bytesOut,reads,writes,deletes,multipartObjects,multipartObjectParts,multipartObjectBytes,multipartUploads,multipartUploadParts,multipartUploadBytes,deleted,valid finance.hcp.example.com,europe,finance,2017-02-17T00:00:00-0500,2017-02-17T23:59:59-0500,6,134243721,134270976,123986263,87561,1,10,0,2,7,93213889,0,0,0,false,true finance.hcp.example.com,europe,hr,2017-02-17T00:00:00-0500,2017-02-17T23:59:59-0500,7,9609368,9621504,9609368,0,0,7,0,0,0,0,0,0,0,false,true finance.hcp.example.com,europe,,2017-02-17T00:00:00-0500,2017-02-17T23:59:59-0500,13,143853089,143892480,133595631,87561,1,17,0,2,7,93213889,0,0,0,false,true