PutData - Add Data

Write the data attached to the request to the distributed ledger.

/api/v1/single/

Request

FieldTypeDescription
Content-TypeStringapplication/octet-stream
X-ALTR-METADATAStringOptional metadata to be associated with the request.
AuthorizationStringchainAPI's authorization protocol relies on a properly formatted authorization header. The accepted format is: "ALTR " + api_key + ":" + signature. signature is a base64-encoded, SHA-256 hash that uses the API key's secret as the key for the hash function. The payload being hashed must follow the format: HTTP-METHOD + "\n" + RESOURCE + "\n" + DATE + "\n". DATE must match X-ALTR-DATE, and RESOURCE must be empty for a POST request. An example payload for a POST request is: "POST\n\n01-01-1970 00:00:00\n"
X-ALTR-DATEDateThe datetime used in the authorization signature. If this is more than 15 minutes past the server's internal clock, the request will be rejected.
Content-LengthNumberNumber
If known, the length of the data being sent to the server. If given alongside X-Content-Length-Hint, Content-Length will be used in evaluating the request.
X-Content-Length-HintNumberIf the size of the request is unkown, X-Content-Length-Hint may be provided. If the hint is less than 3kb, and the request ends up being larger than that, at most 3kb will be written to the distributed ledger.
date = new Date();
payload = 'POST\n\n' + date + '\n';
API_KEY = <your API key>;
SECRET = <your API secret>;
{
    "X-ALTR-DATE": date,
    "Authorization": "ALTR " + API_KEY + ":" + base64(hmac-sha256(payload, SECRET)),
    "X-ALTR-METADATA": "<metadata>",
    "X-Content-Length-Hint": 500
}

200

FieldTypeDescription
referenceTokenStringToken used to access the data that is being written to the distributed ledger.
HTTP/1.1 200 OK
{
    "success": true
    "response": {
        "data": {
            "referenceToken": <token>
        }
    }
}

Error Codes

CodeNameDescription
400bad_requestOrganization data cap exceeded.
401unauthorizedThe API key could not be authenticated.
403forbiddenAPI key does not have write permissions.
503internal_errorThe webserver encountered an unexpected error.
HTTP/1.1 503 Internal Server Error
{
  "success": false,
  "response": {
      "error_type": "internal_error",
      "error_message": "Unable to process request at this time."
  }
}
HTTP/1.1 400 Bad Request
{
  "success": false,
  "response": {
      "error_type": "bad_request",
      "error_message": "Organization data cap exceeded"
  }
}
HTTP/1.1 401 Authentication Required
{
  "success": false,
  "response": {
      "error_type": "unauthorized",
      "error_message":  "API key must be included in header."
  }
}
HTTP/1.1 403 Forbidden
{
  "success": false,
  "response": {
      "error_type": "forbidden",
      "error_message":  "API key does not have write permission."
  }
}