Uploading Documents

This topic includes the following:

  • How to upload a document

Uploading Documents

Uploading Documents

To add a document to an existing package, you must first create the Document object.  Once the Document object has been created, find the PackageId you wish to add the document to and then use the client to upload that document.

Endpoint:
POST /api/packages/{packageId}/documents

Headers:
Accept: text/html
Content-Type: multipart/form-data
Authorization: Basic api_key

Request:
------WebKitFormBoundary1bNO60n7FqP5WO4t
				Content-Disposition: form-data; name="file"; filename="testDocumentExtraction.pdf"
				Content-Type: application/pdf
				%PDF-1.5
				%µµµµ
				1 0 obj
				<>>>
				endobj.... 
------WebKitFormBoundary1bNO60n7FqP5WO4t
				Content-Disposition: form-data; name="payload"
				{
				"name": "Example Document",
				"description": "Example Description",
				"id": "Document1"
				}
------WebKitFormBoundary1bNO60n7FqP5WO4t--
Document document = DocumentBuilder.newDocumentWithName("Example Document")
				.fromFile("DOC_FILE_PATH")
				.fromStream( documentStream, DocumentType.PDF );
				.withId("document1")
				.withExtractionType(ExtractionType.TEXT_TAGS_ONLY)
				.enableExtraction()
				.withDescription("Sample Document Description")
			.build();

eslClient.uploadDocument(document, packageId);
Document document = DocumentBuilder.NewDocumentNamed("Example Document")
				.FromFile("DOC_FILE_PATH")
				.fromStream( documentStream, DocumentType.PDF );
				.WithId("document1")
				.WithExtractionType(ExtractionType.TEXT_TAGS_ONLY)
				.EnableExtraction()
				.WithDescription("Sample Document Description")
			.Build();

eslClient.UploadDocument(document, packageId);