Reading Opportunity Documents

Opportunity Documents are read from the following endpoint

  • Document: /api/documents/opportunities/<opportunityId>/<documentId>

Example Request


        curl -X GET \
        https://compass.cosential.com/api/documents/opportunities/123456/123 \
        -H 'Authorization: Basic *****************=' \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/json' \
        -H 'x-compass-api-key: ********-****-****-*****-************' \
        -H 'x-compass-firm-id: *' 
    

Example Response

    
        Cache-Control →no-cache
        CompassVersion →1.0
        Content-Disposition →attachment; filename="YourDocument.docx"
        Content-Length →14702
        Content-Type →application/vnd.openxmlformats-officedocument.wordprocessingml.document
        Date →Mon, 26 Mar 2018 16:38:21 GMT

        [binary data]
    

Uploading Opportunity Document

Opportunity documents are created by uploading a document via HTTP POST. The endpoint /api/documents/opportunities/<opportunityId> will accept one or more files via mime-mulitpart. A successfully call returns a JSON array containing a response for each Document uploaded. By default documents are uploaded as shared with a Title that is the same as the document name. These items can later be altered at the /api/opportunities/<opportunityId>/documents/<documentId> endpoint via HTTP PUT.

Example Request creating 2 new Documents


        curl -X POST \
        https://compass.cosential.com/api/documents/opportunities/123456/ \
        -H 'Authorization: Basic *****************=' \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/x-www-form-urlencoded' \
        -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
        -H 'x-compass-api-key: ***********************-*********' \
        -H 'x-compass-firm-id: *' \
        -F '=@C:\Users\User01\Documents\Synchronizer.vsdx' \
        -F '=@C:\Users\User01\Documents\firms.xlsx'
    

Response


[
    {
        "DocumentId": 394223,
        "IsPrivate": false,
        "ClientFileName": "Synchronizer.vsdx",
        "Created": "2018-03-26T11:58:16.4644658-05:00",
        "IsDeleted": false,
        "Description": null,
        "MetaData": null,
        "Extension": ".vsdx",
        "FileSize": 65770,
        "Title": "Synchronizer.vsdx",
        "Category": null
    },
    {
        "DocumentId": 394224,
        "IsPrivate": false,
        "ClientFileName": "firms.xlsx",
        "Created": "2018-03-26T11:58:17.1389357-05:00",
        "IsDeleted": false,
        "Description": null,
        "MetaData": null,
        "Extension": ".xlsx",
        "FileSize": 9507,
        "Title": "firms.xlsx",
        "Category": null
    }
]
    

Example Request creating new Document via URL

    
        curl -X POST \
        'https://compass.cosential.com/api/documents/opportunities/876423/?url=https://download.thefileserver.com/manuals/all-products/precision.pdf' \
        -H 'Authorization: Basic *****************=' \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/x-www-form-urlencoded' \
        -H 'x-compass-api-key: ***********************-*********' \
        -H 'x-compass-firm-id: *' 
    

Response


[
    {
        "DocumentId": 394226,
        "IsPrivate": false,
        "ClientFileName": "precision.pdf",
        "Created": "2018-03-26T13:37:25.6082753-05:00",
        "IsDeleted": false,
        "Description": null,
        "MetaData": null,
        "Extension": ".pdf",
        "FileSize": 141804,
        "Title": "precision.pdf",
        "Category": null
    }
]
    

Updating Opportunity Document Data

You can use the endpoint /api/opportunities/<opportunityId>/documents/<documentId> for updating opportunity document metadata.

Example Request updating Opportunity Document Metadata


        curl -X PUT \
        https://compass.cosential.com/api/opportunities/876423/documents/394226 \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/json' \
        -H 'x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd' \
        -d '{
        "Description": "My description",
        "Extension": ".pdf",
        "FileSize": 141804,
        "Title": "precision"
        }'
    

Response


    {
        "DocumentId": 394226,
        "IsPrivate": false,
        "ClientFileName": "precision.pdf",
        "Created": "2018-03-26T13:37:25.607",
        "IsDeleted": false,
        "Description": "precision",
        "MetaData": null,
        "Extension": ".pdf",
        "FileSize": 141804,
        "Title": "precision.pdf",
        "Category": null
    }
    

Updating Document Data

To replace a binary document, Use an HTTP PUT to the endpoint /api/documents/opportunities/<opportunityId>/<documentId>.


        curl -X POST \
        https://compass.cosential.com/api/documents/opportunities/123456/789012 \
        -H 'Authorization: Basic *****************=' \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/x-www-form-urlencoded' \
        -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
        -H 'x-compass-api-key: ***********************-*********' \
        -H 'x-compass-firm-id: *' \
        -F '=@C:\Users\User01\Documents\Synchronizer.vsdx'
    

Delete Opportunity Document

An HTTP DELETE request to the opportunity document metadata endpoint OR the document endpoint will delete both the metadata AND the document.

  • The Document metadata endpoint is: /api/opportunities/<opportunityId>/documents/<documentId>
  • The Document endpoint is: /api/documents/opportunities/<opportunityId>/<documentId>

Example Request

    curl -X DELETE \
    -H 'x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd' \ 
    https://compass.cosential.com/api/opportunities/123456/documents/1234

Example Response

[200 OK]

Reading Project Documents

Project Documents are read from the following endpoint

  • Document: /api/documents/projects/<projectId>/<documentId>

Example Request


        curl -X GET \
        https://compass.cosential.com/api/documents/projects/123456/123 \
        -H 'Authorization: Basic *****************=' \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/json' \
        -H 'x-compass-api-key: ********-****-****-*****-************' \
        -H 'x-compass-firm-id: *' 
    

Example Response


        Cache-Control →no-cache
        CompassVersion →1.0
        Content-Disposition →attachment; filename="YourDocument.docx"
        Content-Length →14702
        Content-Type →application/vnd.openxmlformats-officedocument.wordprocessingml.document
        Date →Mon, 26 Mar 2018 16:38:21 GMT

        [binary data]
    

Uploading Project Document

Project documents are created by uploading a document via HTTP POST. The endpoint /api/documents/projects/<projectId> will accept one or more files via mime-multipart. A successful call returns a JSON array containing a response for each Document uploaded. By default documents are uploaded as shared with a Title that is the same as the document name. These items can later be altered at the /api/projects/<projectId>/documents/<documentId> endpoint via HTTP PUT.

Example Request creating 2 new Documents


        curl -X POST \
        https://compass.cosential.com/api/documents/projects/123456/ \
        -H 'Authorization: Basic *****************=' \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/x-www-form-urlencoded' \
        -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
        -H 'x-compass-api-key: ***********************-*********' \
        -H 'x-compass-firm-id: *' \
        -F '=@C:\Users\User01\Documents\Synchronizer.vsdx' \
        -F '=@C:\Users\User01\Documents\firms.xlsx'
    

Response


[
    {
        "DocumentId": 394223,
        "IsPrivate": false,
        "ClientFileName": "Synchronizer.vsdx",
        "Created": "2018-03-26T11:58:16.4644658-05:00",
        "IsDeleted": false,
        "Description": null,
        "MetaData": null,
        "Extension": ".vsdx",
        "FileSize": 65770,
        "Title": "Synchronizer.vsdx",
        "Category": null
    },
    {
        "DocumentId": 394224,
        "IsPrivate": false,
        "ClientFileName": "firms.xlsx",
        "Created": "2018-03-26T11:58:17.1389357-05:00",
        "IsDeleted": false,
        "Description": null,
        "MetaData": null,
        "Extension": ".xlsx",
        "FileSize": 9507,
        "Title": "firms.xlsx",
        "Category": null
    }
]
    

Example Request creating new Document via URL


        curl -X POST \
        'https://compass.cosential.com/api/documents/projects/876423/?url=https://download.thefileserver.com/manuals/all-products/precision.pdf' \
        -H 'Authorization: Basic *****************=' \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/x-www-form-urlencoded' \
        -H 'x-compass-api-key: ***********************-*********' \
        -H 'x-compass-firm-id: *' 
    

Response


[
    {
        "DocumentId": 394226,
        "IsPrivate": false,
        "ClientFileName": "precision.pdf",
        "Created": "2018-03-26T13:37:25.6082753-05:00",
        "IsDeleted": false,
        "Description": null,
        "MetaData": null,
        "Extension": ".pdf",
        "FileSize": 141804,
        "Title": "precision.pdf",
        "Category": null
    }
]
    

Updating Project Document Data

You can use the endpoint /api/projects/<projectId>/documents/<documentId> for updating project document metadata.

Example Request updating Project Document Metadata


        curl -X PUT \
        https://compass.cosential.com/api/projects/876423/documents/394226 \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/json' \
        -H 'x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd' \
        -d '{
        "Description": "My description",
        "Extension": ".pdf",
        "FileSize": 141804,
        "Title": "precision"
        }'
    

Response


    {
        "DocumentId": 394226,
        "IsPrivate": false,
        "ClientFileName": "precision.pdf",
        "Created": "2018-03-26T13:37:25.607",
        "IsDeleted": false,
        "Description": "precision",
        "MetaData": null,
        "Extension": ".pdf",
        "FileSize": 141804,
        "Title": "precision.pdf",
        "Category": null
    }
    

Updating Document Data

To replace a binary document, Use an HTTP PUT to the endpoint /api/documents/projects/<projectId>/<documentId>.


        curl -X POST \
        https://compass.cosential.com/api/documents/projects/123456/789012 \
        -H 'Authorization: Basic *****************=' \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/x-www-form-urlencoded' \
        -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
        -H 'x-compass-api-key: ***********************-*********' \
        -H 'x-compass-firm-id: *' \
        -F '=@C:\Users\User01\Documents\Synchronizer.vsdx'
    

Delete Project Document

An HTTP DELETE request to the project document metadata endpoint OR the document endpoint will delete both the metadata AND the document.

  • The Document metadata endpoint is: /api/projects/<projectId>/documents/<documentId>
  • The Document endpoint is: /api/documents/projects/<projectId>/<documentId>

Example Request

    curl -X DELETE \
    -H 'x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd' \ 
    https://compass.cosential.com/api/projects/123456/documents/1234

Example Response

[200 OK]

Reading Project Reference Documents

Project Reference Documents are read from the following endpoint

  • Documents: /api/projects/<projectId>/references/<referenceId>/documents
  • Document: /api/projects/<projectId>/references/<referenceId>/documents/<documentId>

Example Request


        curl -X GET \
        https://compass.cosential.com/api/projects/123456/references/123456/documents \
        -H 'Authorization: Basic *****************=' \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/json' \
        -H 'x-compass-api-key: ********-****-****-*****-************' \
        -H 'x-compass-firm-id: *' 
    

Example Response


        Cache-Control →no-cache
        CompassVersion →1.0
        Content-Disposition →attachment; filename="YourDocument.docx"
        Content-Length →14702
        Content-Type →application/vnd.openxmlformats-officedocument.wordprocessingml.document
        Date →Mon, 26 Mar 2018 16:38:21 GMT

        [binary data]
    

Uploading Project Reference Document

Project Reference documents are created by uploading a document via HTTP POST. The endpoint /api/projects/<projectId>/references/<referenceId>/documents will accept one or more files via mime-multipart. A successful call returns a JSON array containing a response for each Document uploaded. By default documents are uploaded as shared with a Title that is the same as the document name. These items can later be altered at the /api/projects/<projectId>/references/<referenceId>/documents/<documentId> endpoint via HTTP PUT.

Example Request creating 2 new Documents


        curl -X POST \
        https://compass.cosential.com/api/projects/123456/references/123456/documents \
        -H 'Authorization: Basic *****************=' \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/x-www-form-urlencoded' \
        -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
        -H 'x-compass-api-key: ***********************-*********' \
        -H 'x-compass-firm-id: *' \
        -F '=@C:\Users\User01\Documents\Synchronizer.vsdx' \
        -F '=@C:\Users\User01\Documents\firms.xlsx'
    

Response


[
    {
        "DocumentId": 394223,
        "IsPrivate": false,
        "ClientFileName": "Synchronizer.vsdx",
        "Created": "2018-03-26T11:58:16.4644658-05:00",
        "IsDeleted": false,
        "Description": null,
        "MetaData": null,
        "Extension": ".vsdx",
        "FileSize": 65770,
        "Title": "Synchronizer.vsdx",
        "Category": null
    },
    {
        "DocumentId": 394224,
        "IsPrivate": false,
        "ClientFileName": "firms.xlsx",
        "Created": "2018-03-26T11:58:17.1389357-05:00",
        "IsDeleted": false,
        "Description": null,
        "MetaData": null,
        "Extension": ".xlsx",
        "FileSize": 9507,
        "Title": "firms.xlsx",
        "Category": null
    }
]
    

Example Request creating new Document via URL


        curl -X POST \
        'https://compass.cosential.com/api/projects/123456/references/123456/documents?url=https://download.thefileserver.com/manuals/all-products/precision.pdf' \
        -H 'Authorization: Basic *****************=' \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/x-www-form-urlencoded' \
        -H 'x-compass-api-key: ***********************-*********' \
        -H 'x-compass-firm-id: *' 
    

Response


[
    {
        "DocumentId": 394226,
        "IsPrivate": false,
        "ClientFileName": "precision.pdf",
        "Created": "2018-03-26T13:37:25.6082753-05:00",
        "IsDeleted": false,
        "Description": null,
        "MetaData": null,
        "Extension": ".pdf",
        "FileSize": 141804,
        "Title": "precision.pdf",
        "Category": null
    }
]
    

Updating Project Reference Document Data

You can use the endpoint /api/projects/<projectId>/references/<referenceId>/documents/<documentId> for updating project reference document metadata.

Example Request updating Project Reference Document Metadata


        curl -X PUT \
        https://compass.cosential.com/api/projects/876423/references/123456/documents/394226 \
        -H 'Cache-Control: no-cache' \
        -H 'Content-Type: application/json' \
        -H 'x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd' \
        -d '{
        "Description": "My description",
        "Extension": ".pdf",
        "FileSize": 141804,
        "Title": "precision"
        }'
    

Response


    {
        "DocumentId": 394226,
        "IsPrivate": false,
        "ClientFileName": "precision.pdf",
        "Created": "2018-03-26T13:37:25.607",
        "IsDeleted": false,
        "Description": "precision",
        "MetaData": null,
        "Extension": ".pdf",
        "FileSize": 141804,
        "Title": "precision.pdf",
        "Category": null
    }
    

Updating Document Data

Compass does not update document binaries once uploaded. To replace a binary document, first delete the document with an HTTP DELETE request and then upload a new Binary via HTTP POST.

Delete Project Reference Document

An HTTP DELETE request to the project reference document metadata endpoint OR the document endpoint will delete both the metadata AND the document.

  • The Document metadata endpoint is: /api/projects/<projectId>/references/<referenceId>/documents/<documentId>
  • The Document endpoint is: /api/documents/projectreferences/<referenceId>/<documentId>

Example Request

    curl -X DELETE \
    -H 'x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd' \ 
    https://compass.cosential.com/api/projects/123456/references/123456/documents/1234

Example Response

[200 OK]