Send a document API test stubs
Version and Status
HMLR does not currently provide a test environment for integrators using our Business Gateway APIs. Instead, we’ve provided example code for different scenarios to demonstrate what you should expect to seewhen developing your own services.
Due to technical limitations, these stubs will only allow you to get an upload url. The URL won’t work and the PUT
endpoint is not stubbed.
Base URL: https://bgtest.landregistry.gov.uk/bg2test/api
Scenario 1: Success
Request
Method: POST
Endpoint: /v0/documents/url
Headers: Authorization: <any-value>
{
"data": {
"document_type": "CHARGE",
"additional_provider_filter": "string",
"file_length": 123123,
"file_sha256": "This is a 44 character string. blah blah bla"
}
}
Response
Status: 200
{
"data": {
"upload_url": "https://www.your-upload-url-would-be-here.com",
"document_id": "12345678-1234-1234-1234-1234-123456789abc"
}
}
Note: This response body may contain any random UUID.
Scenario 2: Invalid Document Type
Request
Method: POST
Endpoint: /v0/documents/url
Headers: Authorization: <any-value>
{
"data": {
"document_type": "INVALID",
"additional_provider_filter": "string",
"file_length": 123123,
"file_sha256": "This is a 44 character string. blah blah bla"
}
}
Response
Status: 400
{
"type": "https://landregistry.github.io/bgtechdoc/problems/global#bad-request",
"title": "Bad Request",
"detail": "The request is invalid or malformed.",
"status": "400",
"errors": [{
"type": "L1A_JSON_PARSE_ERROR",
"detail": "Invalid document_type: 'INVALID'"
}]
}
Scenario 3: Invalid file length (too small)
Request
Method: POST
Endpoint: /v0/documents/url
Headers: Authorization: <any-value>
{
"data": {
"document_type": "CHARGE",
"additional_provider_filter": "string",
"file_length": 0,
"file_sha256": "This is a 44 character string. blah blah bla"
}
}
Response
Status: 400
{
"type": "https://landregistry.github.io/bgtechdoc/problems/global#bad-request",
"title": "Bad Request",
"detail": "The request is invalid or malformed.",
"status": "400",
"errors": [{
"type": "L1A_SCHEMA_VALIDATION_ERROR",
"detail": "There are problems with the JSON provided [must be greater than or equal to 1]"
}]
}
Scenario 4: Invalid file length (too large)
Request
Method: POST
Endpoint: /v0/documents/url
Headers: Authorization: <any-value>
{
"data": {
"document_type": "CHARGE",
"additional_provider_filter": "string",
"file_length": 419430401,
"file_sha256": "This is a 44 character string. blah blah bla"
}
}
Response
Status: 400
{
"type": "https://landregistry.github.io/bgtechdoc/problems/global#bad-request",
"title": "Bad Request",
"detail": "The request is invalid or malformed.",
"status": "400",
"errors": [{
"type": "L1A_SCHEMA_VALIDATION_ERROR",
"detail": "There are problems with the JSON provided [must be less than or equal to 41943040]"
}]
}
Scenario 5: Invalid File_SHA256
Request
Method: POST
Endpoint: /v0/documents/url
Headers: Authorization: <any-value>
{
"data": {
"document_type": "CHARGE",
"additional_provider_filter": "string",
"file_length": 123123,
"file_sha256": "This is less than 44 characters."
}
}
Response
Status: 400
{
"type": "https://landregistry.github.io/bgtechdoc/problems/global#bad-request",
"title": "Bad Request",
"detail": "The request is invalid or malformed.",
"status": "400",
"errors": [{
"type": "L1A_SCHEMA_VALIDATION_ERROR",
"detail": "There are problems with the JSON provided [size must be between 44 and 44]"
}]
}