Retreive a Document

Use this endpoint to retreive a binary document from the blockchain. The document will be placed in a temporary location on the API server so it can be retreived by your calling program.

Outcome

The result of the API is to retrieve a document from the blockchain and return a URL where the document can be retrieved.

Endpoint

https://tracapi.com/api.v2/get_doc/

Fields/Parameters

Fields/Parameter Value
auth_key Your api key "blockchain address:secret key" assigned one of the locations on your account. This will be included in the new asset record to identify the creator of the location record. Required
asset_id The asset identifier of the document. Required

Test it

Sample Code - PHP/Curl

<?php

$auth_key=$_POST['auth_key'];
$asset_id=$_POST['asset_id'];

//URL of the endpoint.
$url = 'https://tracapi.com/api.v2/get_doc/';

//Create an array of POST data to be sent to the endpoint.
$fields = array(
'auth_key' => $auth_key,
'asset_id' => $asset_id);

//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);

//execute post
$result = curl_exec($ch);

//echo the result
echo $result;

//close connection
curl_close($ch);
?>