Documents
Initiate Multipart Upload
POST
/
api
/
v1
/
documents
/
multipart
/
initiate
Initiate Multipart Upload
curl --request POST \
--url https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"content_type": "<string>",
"file_size": 123,
"document_category": "<string>",
"resource_type": "<string>",
"resource_id": "<string>",
"description": "<string>",
"tags": "<string>",
"is_public": false,
"allowed_departments": "<string>",
"allowed_users": "<string>",
"allowed_roles": "<string>",
"part_size": 104857600,
"expires_hours": 12
}
'import requests
url = "https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate"
payload = {
"filename": "<string>",
"content_type": "<string>",
"file_size": 123,
"document_category": "<string>",
"resource_type": "<string>",
"resource_id": "<string>",
"description": "<string>",
"tags": "<string>",
"is_public": False,
"allowed_departments": "<string>",
"allowed_users": "<string>",
"allowed_roles": "<string>",
"part_size": 104857600,
"expires_hours": 12
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
filename: '<string>',
content_type: '<string>',
file_size: 123,
document_category: '<string>',
resource_type: '<string>',
resource_id: '<string>',
description: '<string>',
tags: '<string>',
is_public: false,
allowed_departments: '<string>',
allowed_users: '<string>',
allowed_roles: '<string>',
part_size: 104857600,
expires_hours: 12
})
};
fetch('https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filename' => '<string>',
'content_type' => '<string>',
'file_size' => 123,
'document_category' => '<string>',
'resource_type' => '<string>',
'resource_id' => '<string>',
'description' => '<string>',
'tags' => '<string>',
'is_public' => false,
'allowed_departments' => '<string>',
'allowed_users' => '<string>',
'allowed_roles' => '<string>',
'part_size' => 104857600,
'expires_hours' => 12
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"file_size\": 123,\n \"document_category\": \"<string>\",\n \"resource_type\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": \"<string>\",\n \"is_public\": false,\n \"allowed_departments\": \"<string>\",\n \"allowed_users\": \"<string>\",\n \"allowed_roles\": \"<string>\",\n \"part_size\": 104857600,\n \"expires_hours\": 12\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"file_size\": 123,\n \"document_category\": \"<string>\",\n \"resource_type\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": \"<string>\",\n \"is_public\": false,\n \"allowed_departments\": \"<string>\",\n \"allowed_users\": \"<string>\",\n \"allowed_roles\": \"<string>\",\n \"part_size\": 104857600,\n \"expires_hours\": 12\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"file_size\": 123,\n \"document_category\": \"<string>\",\n \"resource_type\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": \"<string>\",\n \"is_public\": false,\n \"allowed_departments\": \"<string>\",\n \"allowed_users\": \"<string>\",\n \"allowed_roles\": \"<string>\",\n \"part_size\": 104857600,\n \"expires_hours\": 12\n}"
response = http.request(request)
puts response.read_body{
"document_id": "<string>",
"upload_id": "<string>",
"object_name": "<string>",
"part_urls": [
{
"part_number": 123,
"url": "<string>"
}
],
"total_parts": 123,
"part_size": 123,
"expires_hours": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Required string length:
1 - 255Maximum string length:
50Maximum string length:
50Maximum string length:
255Maximum string length:
1000Required range:
x >= 5242880Required range:
1 <= x <= 72⌘I
Initiate Multipart Upload
curl --request POST \
--url https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"content_type": "<string>",
"file_size": 123,
"document_category": "<string>",
"resource_type": "<string>",
"resource_id": "<string>",
"description": "<string>",
"tags": "<string>",
"is_public": false,
"allowed_departments": "<string>",
"allowed_users": "<string>",
"allowed_roles": "<string>",
"part_size": 104857600,
"expires_hours": 12
}
'import requests
url = "https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate"
payload = {
"filename": "<string>",
"content_type": "<string>",
"file_size": 123,
"document_category": "<string>",
"resource_type": "<string>",
"resource_id": "<string>",
"description": "<string>",
"tags": "<string>",
"is_public": False,
"allowed_departments": "<string>",
"allowed_users": "<string>",
"allowed_roles": "<string>",
"part_size": 104857600,
"expires_hours": 12
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
filename: '<string>',
content_type: '<string>',
file_size: 123,
document_category: '<string>',
resource_type: '<string>',
resource_id: '<string>',
description: '<string>',
tags: '<string>',
is_public: false,
allowed_departments: '<string>',
allowed_users: '<string>',
allowed_roles: '<string>',
part_size: 104857600,
expires_hours: 12
})
};
fetch('https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filename' => '<string>',
'content_type' => '<string>',
'file_size' => 123,
'document_category' => '<string>',
'resource_type' => '<string>',
'resource_id' => '<string>',
'description' => '<string>',
'tags' => '<string>',
'is_public' => false,
'allowed_departments' => '<string>',
'allowed_users' => '<string>',
'allowed_roles' => '<string>',
'part_size' => 104857600,
'expires_hours' => 12
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"file_size\": 123,\n \"document_category\": \"<string>\",\n \"resource_type\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": \"<string>\",\n \"is_public\": false,\n \"allowed_departments\": \"<string>\",\n \"allowed_users\": \"<string>\",\n \"allowed_roles\": \"<string>\",\n \"part_size\": 104857600,\n \"expires_hours\": 12\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"file_size\": 123,\n \"document_category\": \"<string>\",\n \"resource_type\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": \"<string>\",\n \"is_public\": false,\n \"allowed_departments\": \"<string>\",\n \"allowed_users\": \"<string>\",\n \"allowed_roles\": \"<string>\",\n \"part_size\": 104857600,\n \"expires_hours\": 12\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.diginacape.co.ke/documents/api/v1/documents/multipart/initiate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"file_size\": 123,\n \"document_category\": \"<string>\",\n \"resource_type\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": \"<string>\",\n \"is_public\": false,\n \"allowed_departments\": \"<string>\",\n \"allowed_users\": \"<string>\",\n \"allowed_roles\": \"<string>\",\n \"part_size\": 104857600,\n \"expires_hours\": 12\n}"
response = http.request(request)
puts response.read_body{
"document_id": "<string>",
"upload_id": "<string>",
"object_name": "<string>",
"part_urls": [
{
"part_number": 123,
"url": "<string>"
}
],
"total_parts": 123,
"part_size": 123,
"expires_hours": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}