The M-Files Community will be updated on Tuesday, April 2, 2024 at 10:00 AM EST / 2:00 PM GMT and the update is expected to last for several hours. The site will be unavailable during this time.

HTTP POST Call - Create object/file in M-Files Vault

Hi there

I try to connect other applications with M-Files through make.com.

Therefore, I use the HTTP component in make to authenticate and afterwards create files.

I understood that first of all, I have to retrieve an authentication token and then include this token in the header of further API calls.

The first step works fine, I get the token, calling /REST/server/authenticationtokens, inlcuding the VaultGuid in the HTTP header.

The status code is 200

But in the next call, including this token in the header, calling i.e. /REST/objects/0.aspx I get an authentication error with status code 403, saying that "Login to vault failed".

Here is the complete response:

[
    {
        "statusCode": 403,
        "headers": [
            {
                "name": "cache-control",
                "value": "private"
            },
            {
                "name": "content-type",
                "value": "application/json; charset=utf-8"
            },
            {
                "name": "x-frame-options",
                "value": "SAMEORIGIN"
            },
            {
                "name": "set-cookie",
                "value": "ASP.NET_SessionId=01tahdh4beljqjapojrdq1x1; path=/; secure; HttpOnly; SameSite=Lax"
            },
            {
                "name": "x-xss-protection",
                "value": "1; mode=block"
            },
            {
                "name": "x-content-type-options",
                "value": "nosniff"
            },
            {
                "name": "strict-transport-security",
                "value": "max-age=31536000; includeSubDomains;"
            },
            {
                "name": "date",
                "value": "Fri, 21 Apr 2023 11:55:31 GMT"
            },
            {
                "name": "connection",
                "value": "close"
            },
            {
                "name": "content-length",
                "value": "335"
            }
        ],
        "cookieHeaders": [
            "ASP.NET_SessionId=01tahdh4beljqjapojrdq1x1; path=/; secure; HttpOnly; SameSite=Lax"
        ],
        "data": {
            "Status": 403,
            "URL": "/objects/0",
            "Method": "POST",
            "Exception": {
                "Name": "UnauthorizedAccessException",
                "Message": "Login to vault failed"
            },
            "Stack": "Error reference ID: f9988300-2756-4628-b9af-c98d970ddc7e",
            "Message": "Login to vault failed",
            "IsLoggedToVault": false,
            "IsLoggedToApplication": false,
            "ExceptionName": "UnauthorizedAccessException"
        },
        "fileSize": 335
    }
]

Does anyone have an idea what is going wrong or what I did not consider?

The connection is established with an M-Files user, so basic authentication plus the token. The M-Files user has full access to the vault.

Would appreciate your help.

Kind regards,

Dario