FileReference

  • 15.5
This article is may not be up to date with the latest stable release of M4.

Description

The FileReference endpoint provides the API consumer with access to methods pertaining to file references and related data objects. The endpoint allows consumers to load file references, add new file references, update file references, and delete file references.

Methods

URL base/Mapcom/FileReference/Specification
Action GET
Description Returns a data dictionary that details the available web service methods related to the FileReference endpoint.
Parameters None
 Returns  A JSON object with method descriptions
Sample Return Object
	[
    {
        "HttpAction": "Get",
        "MethodName": "GetFileReference",
        "Description": "Returns the record for a single file reference given the passed in ID value (see Path).",
        "Path": "/FileReferece/GetFileReference/25032"
    },
    {
        "HttpAction": "Post",
        "MethodName": "GetFileReferencesByLinkTableAndElementID",
        "Description": "Returns a collection of file references given the passed in table name and element ID.",
        "Format": {
            "M4LinkTable": "Ticket",
            "ElementID": 362
        }
    },
    {
        "HttpAction": "Post",
        "MethodName": "AddFileReference",
        "Description": "Method allows for the adding of a file reference. The newly created FileReference object is returned.",
        "Format": {
            "ElementID": 751,
            "Layer": 133,
            "FileName": "document.txt",
            "Description": "19e908d6-1d50-49f0-aa8b-3fb4332a12f1",
            "M4LinkTable": "Ticket"
        }
    },
    {
        "HttpAction": "Post",
        "MethodName": "UpdateFileReference",
        "Description": "Method allows for the updating of a file reference. The updated FileReference object is returned.",
        "Format": {
            "ID": 582,
            "ElementID": 224,
            "Layer": 920,
            "FileName": "document.txt",
            "Description": "8316d699-cf82-47a6-91f3-8dc7115c8903",
            "M4LinkTable": "Ticket"
        }
    },
    {
        "HttpAction": "Get",
        "MethodName": "DeleteFileReference",
        "Description": "Deletes the record for a single file reference given the passed in ID value (see Path).",
        "Path": "/FileReferece/DeleteFileReference/25032"
    }
]
URL base/Mapcom/FileReference/GetFileReference/ID
Action GET
Description Returns a FileReference object when given an ID of a valid file reference in the M4 database.
Parameters
Name Required? Type Description
ID Yes Integer An integer value representing the ID of a file reference in the M4 database.
Returns A JSON FileReference data object
Sample Return Object
{
    "ID": 582,
    "ElementID": 224,
    "Layer": 920,
    "FileName": "document.txt",
    "Description": "8316d699-cf82-47a6-91f3-8dc7115c8903",
    "M4LinkTable": "Ticket"
}
URL base/Mapcom/FileReference/GetFileReferencesByLinkTableAndElementID
Action POST
Description Gets a collection of FileReference objects given the passed in table name and element ID.
Parameters
Name Required? Type Description
M4LinkTable Yes String The table name of the file reference.
ElementID Yes Integer The ID of the Element in the table referenced by M4LinkTable.
Sample JSON Package
{
    "M4LinkTable": "Ticket",
    "ElementID": 224
}
Returns A collection of JSON FileReference data objects
Sample Return Object
[
    {
        "ID": 582,
        "ElementID": 224,
        "Layer": 920,
        "FileName": "document.txt",
        "Description": "8316d699-cf82-47a6-91f3-8dc7115c8903",
        "M4LinkTable": "Ticket"
    },
    {
        "ID": 583,
        "ElementID": 224,
        "Layer": 920,
        "FileName": "document.txt",
        "Description": "8316d699-cf82-47a6-91f3-8dc7115c8903",
        "M4LinkTable": "Ticket"
    }
]
Business Rules
Any violations of these business rules result in an appropriate error message being returned to the API consumer.
  • M4LinkTable: must not be null or blank
  • ElementID: must not be null
URL base/Mapcom/FileReference/AddFileReference
Action POST
Description Adds the specified FileReference object and returns the newly added FileReference object.
Parameters
Name Required? Type Description
ElementID No Integer The element ID of the file reference.
Layer No Integer The layer of the file reference.
FileName Yes String The file name of the file reference.
Description No String The description of the file reference.
M4LinkTable No String The link table of the file reference.
Sample JSON Package
{
    "ElementID": 751,
    "Layer": 133,
    "FileName": "document.txt",
    "Description": "19e908d6-1d50-49f0-aa8b-3fb4332a12f1",
    "M4LinkTable": "Ticket"
}
Returns A JSON FileReference data object
Sample Return Object
{
    "ID": 582,
    "ElementID": 751,
    "Layer": 133,
    "FileName": "document.txt",
    "Description": "19e908d6-1d50-49f0-aa8b-3fb4332a12f1",
    "M4LinkTable": "Ticket"
}
Business Rules
Any violations of these business rules result in an appropriate error message being returned to the API consumer.
  • FileName: must not be null or blank
URL base/Mapcom/FileReference/UpdateFileReference
Action POST
Description Updates the specified FileReference object and returns the newly updated FileReference object.
Parameters
Name Required? Type Description
ID Yes Integer The ID of the file reference.
ElementID No Integer The element ID of the file reference.
Layer No Integer The layer of the file reference.
FileName Yes String The file name of the file reference.
Description No String The description of the file reference.
M4LinkTable No String The link table of the file reference.
Sample JSON Package
{
    "ID": 582,
    "ElementID": 751,
    "Layer": 133,
    "FileName": "document.txt",
    "Description": "19e908d6-1d50-49f0-aa8b-3fb4332a12f1",
    "M4LinkTable": "Ticket"
}
Returns A JSON FileReference data object
Sample Return Object
{
    "ID": 582,
    "ElementID": 751,
    "Layer": 133,
    "FileName": "document.txt",
    "Description": "19e908d6-1d50-49f0-aa8b-3fb4332a12f1",
    "M4LinkTable": "Ticket"
}
Business Rules
Any violations of these business rules result in an appropriate error message being returned to the API consumer.
  • FileName: must not be null or blank
URL base/Mapcom/FileReference/DeleteFileReference/ID
Action GET
Description Deletes a FileReference object when given an ID of a valid file reference in the M4 database.
Parameters
Name Required? Type Description
ID Yes Integer An integer value representing the ID of a file reference in the M4 database.
Returns A JSON FileReference data object
Sample Return Object
{
  "Message": "The FileReference with ID [55] was deleted successfully."
}

Was this article helpful?

Related Articles