Using Postman to Test POST for Documents using SedonaAPI

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.   

Graphical user interface, text, application 
Description automatically generated 

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. 

Graphical user interface, text, application, email 
Description automatically generated 

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. 

 Graphical user interface, text, application, chat or text message 
Description automatically generated 

You should see a setting for Working Directory. 

Graphical user interface, text, application 
Description automatically generated 

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. 

Graphical user interface, text, application, email, website 
Description automatically generated 

When creating the request, select Body and then select form-data. 

In the Key select file. 

Graphical user interface, text, application 
Description automatically generated 

In Value click the Select Files button and browse to the file which should be in the Working directory from the Postman settings. 

Graphical user interface, application 
Description automatically generated  

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. 

Text 
Description automatically generated 

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. 

Graphical user interface, text, application, email 
Description automatically generated 

Was this article helpful?
Thank you for your feedback!
User Icon

Thank you! Your comment has been submitted for approval.