Document¶
Create document¶
POST /api/document Create new document
Create new document
Sample request:
curl --location --request POST '/api/document' \
--header 'authorization: bearer [accesstoken]' \
--header 'Content-Type: application/json' \
--data-raw '{
"docid": null,
"name": "newdoc.pdf",
"doctype": "doc"
}'
POST /api/document
Host:
authorization: bearer [accesstoken]
Content-Type: application/json
{
"docid": null,
"name": "newdoc.pdf",
"doctype": "docerer"
}
Sample response:
{
"itemId":"f5bcbccd-2aa0-4075-b1be-de3a3f541734",
"fileId":"f5bcbccd-2aa0-4075-b1be-de3a3f541734",
"container":"string",
"sas":"string",
"url":"string",
"subdocid":0,
"uploadendpoint":"string"
}
Responses | |
---|---|
200: OK | Return sas url (Upload url endpoint) |
400: Bad Request | If filename != "" and Length less than 3 |
PUT [upload-endpoint] Upload file
Upload file
[upload-endpoint]
get from POST api/document
field uploadendpoint
Request Parameters:
Header | |
---|---|
Content-Type | application/octet-stream |
x-ms-blob-type | BlockBlob |
Body | |
---|---|
data | binary |
Sample request:
curl --location --request PUT '[upload-endpoint]' \
--header 'Content-Type: application/octet-stream' \
--header 'x-ms-blob-type: BlockBlob' \
--data-binary '@'
PUT /
Host: [upload-endpoint]
Content-Type: application/octet-stream
x-ms-blob-type: BlockBlob
"<file contents here>"
Responses | |
---|---|
201: Created | Success |
400: Bad Request | Upload Failed |
403: Forbidden | Authentication Failed |