REST API - HTTP HEAD Method
The HTTP HEAD method lets you submit a request and receive a response with the response body omitted. The purpose of the HEAD method is to save bandwidth if you do not require the response data that is usually included in the body.
If you want to determine the size of an attachment prior to downloading the file, you can use the HTTP HEAD method to submit your Get Attachment request. This allows you to determine the size of the attachment without having to download the file content.
If you want to determine (approximately) how many artifacts exist for a particular filter, you can use the HTTP HEAD method to submit your List Artifacts request. This allows you to determine the size of the response without having to download the response body.
# obtain a token from our get_token() function
token = get_token()
# Of course, this ID would generally come from somewhere else instead of hardcoding it.
project_id = "220870"
artifact_id = "220914"
attachment_id = "3194"
# build the resource uri for listing artifacts in a given project
resource_uri = 'https://production.blueprintcloud.com/api/v1/projects/' + project_id + '/artifacts/' + artifact_id + '/attachments/' + attachment_id
# specify header parameters
'Authorization' : 'BlueprintToken ' + token,
'Accept' : 'application/xml'
# specify the uri parameters
# create the request uri with the uri parameters
request_uri = resource_uri + '?' + urllib.parse.urlencode(uri_parameters_list)
response = requests.head(request_uri, headers=request_header)