Description of Issue:
We need to test to be sure we can upload documents using the SedonaWeb 2.0 API.
Resolution:
Using the SedonaAPI you can upload various types of documents to the SedonaOffice database.
The documents can be associated with:
Customers
Vendors
Employees
Service Tickets
General Documents
Creating a request to create a new document record.
This document assumes you have the information needed to create a collection or call from Postman to your SedonaAPI.
When using the POST api/documents, a multipart http request is made.
The Document model is expected in the "metadata" header.
This example is for a customer-specific document based on the value of SedonaDocumentEnum.
{"SedonaDocumentEnum":"CustomerDocument","SedonaCustomerId":201,"SedonaSiteId":2290,"SecurityLevel":2,"FileName":"Error Registering Account.jfif","UserDescription":"Upload Test 1","DocumentTypeExtension":"FromSA","UserCode":"Admin Admin","Reference1":"http://sclouddebug.sedonaone.local:51000/Dealer/Estimate/Details/Index/1001", "JobId":1813}
The file contents are expected in the form data.
When trying to send a file the actual file needs to be located in the Postman Working Directory. To see this working directory, use the Setting within Postman.
Go to Settings and click Settings from the menu.
You should see a setting for Working Directory.
Copy your file to this folder so it can be found when the POST is sent.
Sending the Request:
To send a request to Postman, you will need the connection information for your site. If you do not have this information you can contact SedonaOffice Support to obtain the connection information.
When creating the request, select Body and then select form-data.
In the Key select file.
In Value click the Select Files button and browse to the file which should be in the Working directory from the Postman settings.
After you select the file click on Headers.
If not already available add the key for metadata and add the model information for your request.
Model and example json to send with your file.
Below is the model for sending a document to SedonaOffice.
Not all fields are required.
The type of document is determined by the value on the SedonaDocumentEnum.
Valid values:
CustomerDocument,
VendorDocument,
ServiceTicketDocument,
GeneralDocument,
EmployeeDocument
Document JSON
{"SedonaDocumentEnum":"CustomerDocument","SedonaCompanyId":0,"SedonaCustomerId":0,//(Optional)"SedonaSiteId":0,(Optional)"SedonaSystemId":0,//(Optional)"SecurityLevel":0,"FileName":"string","DocumentTypeId":0,"UploadDate":"date-time","UserDescription":"string","UserCode":"string","JobId":0, //(Optional)"ServiceTicketId":0, //(Optional)"VendorId":0, //(Optional)"InvoiceId":0, //(Optional)"CheckId":0, //(Optional)"PurchaseOrderId":0, //(Optional)"ReceiptId":0, //(Optional)"Reference1":"string","Reference2":"string","Reference3":"string","Reference4":"string"}
Example:
{"SedonaDocumentEnum":"CustomerDocument","SedonaCustomerId":201,"SedonaSiteId":2290,"SecurityLevel":2,"FileName":"Error Registering Account.jfif","UserDescription":"Upload Test 1","DocumentTypeExtension":"FromSA","UserCode":"Admin Admin","Reference1":"http://sclouddebug.sedonaone.local:51000/Dealer/Estimate/Details/Index/1001", "JobId":1813}
If everything is correct the Post should be successful.