To get info about a single file you have already created, use the /files/[replace file id here]/info endpoint.
The id is the unique id corresponding to your file. The created_at is a Unix timestamp of when it was created. There is page_count, file_type and file_size (in bytes) describing the file. There also a name string.
The parent_directory_id is the directory id that the file is in. If there is no parent directory, for example if the file is at your root, then parent_directory_id will be null.
Finally, the processed_state is "unprocessed", "processed", "processing", or "deprocessed". You may only query files when they are in the "processed" state, which typically takes a few seconds after uploading. If a file was not used after about a week, it may enter the "deprocessed" state and need to be processed again before it can be queried. We are planning to add an API for you to request a file be processed again. In the meantime, just query the file immediately or ensure you query it within a week of creation, or contact us for more support.
Example response:
{
"success": true,
"file": {
"id": "hmxp3",
"created_at": 1686858114000,
"file_size": 569417,
"file_type": "pdf",
"name": "attention is all you need.pdf",
"page_count": 11,
"processed_state": "processed"
}
}
Ruby code to get file info:
require 'net/http'
require 'uri'
uri = URI.parse("https://api1.docalysis.com/api/v1/files/[file id]/info")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer your_api_key_here"
req_options = {
use_ssl: true,
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
puts response.body