HCP Tenant Management Help


Example 9: Retrieving partial object data

Here’s a sample HTTP GET request that retrieves the first 10,000 bytes of an object named status27.txt in the status directory.

Request with curl command line

curl -k -H "Authorization: HCP bXl1c2Vy:3f3c6784e97531774380db177774ac8d"
    -r 0-9999
    "https://finance.europe.hcp.example.com/rest/status/status27.txt" >
    status27a.txt

Request in Python using PycURL

import pycurl
filehandle = open("status27a.txt", 'wb')
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPHEADER, ["Authorization: HCP
  bXl1c2Vy:3f3c6784e97531774380db177774ac8d"])
curl.setopt(pycurl.RANGE, "0-9999")
curl.setopt(pycurl.URL, "https://finance.europe.hcp.example.com \
  /rest/status/status27.txt")
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 /rest/status/status27.txt HTTP/1.1
Range: bytes=0-9999
Host: finance.europe.hcp.example.com
Authorization: HCP bXl1c2Vy:3f3c6784e97531774380db177774ac8d

Response headers

HTTP/1.1 206 Partial Content
X-HCP-Time: 1335347627
X-HCP-SoftwareVersion: 7.0.0.16
Content-Type: text/plain
Content-Range: bytes 0-9999/38985
Content-Length: 10000
X-HCP-ServicedBySystem: hcp.example.com
ETag: "39273c07f4709e6fea1c155c569fa29f"
X-HCP-Type: object
X-HCP-Size: 38985
X-HCP-Hash: SHA-256 36728BA190BC4C377FE4C1A57AEF9B6AFDA98720422960...
X-HCP-VersionId: 80232488876481
X-HCP-IngestTime: 1334851131
X-HCP-RetentionClass:
X-HCP-RetentionString: Deletion Allowed
X-HCP-Retention: 0
X-HCP-IngestProtocol: HTTP
X-HCP-RetentionHold: false
X-HCP-Shred: false
X-HCP-DPL: 2
X-HCP-Index: true
X-HCP-Custom-Metadata: false
X-HCP-ACL: false
X-HCP-Owner: myuser
X-HCP-Domain:
X-HCP-UID:
X-HCP-GID:
X-HCP-Replicated: false
X-HCP-ReplicationCollision: false
X-HCP-ChangeTimeMilliseconds: 1335347627362.00
X-HCP-ChangeTimeString: 2012-04-25T05:53:47-0400
Last-Modified: Wed, 25 Apr 2012 09:53:47 GMT

Response body

The first 10,000 bytes of the contents of status27.txt

© 2015, 2019 Hitachi Vantara Corporation. All rights reserved.