Table of contents

    Overview

    A Document endpoint is used to upload files to MYP. To call this endpoint, use one of the URLs from the following table:

    URL GET PUT POST DELETE
    https://api.mypcorp.com/document
    https://api.mypcorp.com/document/{Guid}

    NB: Currently, the MYP API accepts GET and POST requests. PUT requests will be available in the future.

    Get

    The following table illustrates which fields can be included when receiving a GET response.

    NB: Nested properties are hidden by default. To expand all nested properties, add a query parameter $expand=* to the URL.

    Document
    Field Name Description
    DocumentGuid
    Guid (Identifier)
    Document id.
    DocumentName
    string
    Name of the document.
    CreationDate
    datetime
    Date and time when this Provider Invoice was created.
    ArchiveDate
    DateTime
    Date when the document was archived, if it has been archived.
    DocumentCategory
    object
    A list of DocumentCategory.

    Example JSON format:

    {
      "@odata.context": "https://api.mypcorp.com/document/$metadata#Document(DocumentCategory())",
      "value": [
        {
          "DocumentGuid": "119ae644-5045-4fd2-975a-384bcb3f0161",
          "DocumentName": "Invoice.pdf",
          "CreationDate": "2021-05-11T10:28:47.53+10:00",
          "ArchiveDate": null,
          "DocumentCategory": {
            "DocumentCategoryGuid": "d79f724c-f2d8-4f94-9f06-d53bbd6adea8",
            "Name": "Photography",
            "ArchiveDate": null
          }
        }
      ]
    }

    Post

    A list of documents can be uploaded to MYP API. To upload documents, set the body of the POST request to form-data and add the file in the form-data.

    The following table illustrates which fields can be included when sending a POST request:

    Form-Data
    Field Name Description Required
    Files
    File
    A list of files, or 1 file to upload. Required
    CreatedByStaffGuidList
    Guid
    A list of Staff guids who uploaded each document. The number of staff guids must match the number of files to upload. Required
    DocumentCategoryGuidList
    Guid
    A list of DocumentCategory guids. The number of category guids must match the number of files to upload. Required
    ClientGuidList
    Guid
    A list of Client guids under which each document was uploaded. If this list is not null, then the number of client guids must match the number of files to upload, however some of those client guids can be null. Optional
    Names
    string (256)
    A list of names for the uploaded files. If not omitted, the number of names must match the number of files to upload. Optional

    NB: The order of files matches the order of DocumentCategoryGuidList and Names. For example, the 2nd category guid is used for the 2nd file.

    NB: To get Guids for document categories, call the DocumentCategory endpoint.


    Previous article Next article