I broke my problem down into the following steps and I'm guessing that others have done the same thing as the steps would apply to almost anyone who wants to insert a file into a vault.
[list type=decimal]
- Get the authentication token for a vault by posting to REST/server/authenticationtokens
- Use the returned authtoken to upload a file to the server
[/list]
I've tried to post to /files, http://www.m-files.com/mfws/resources/files.html by following the example given for C# (it's not too hard to transpose the C# example into REST) but I haven't had any luck as I apparently haven't correctly completed the first step. I get back a auth token and put it in X-Authentication. The error I get makes me think that although I have logged into the application, I haven't passed the right credentials in to log into the vault?
"{""Status"":401,""URL"":""/files"",
""Method"":""POST"",""Exception"":{""Name"":""UnauthorizedAccessException"",""Message"":""Login to vault failed"",""Stack"":[{""FileName"":"""",""LineNumber"":-1,""ClassName"":""MFWS.RestFilters.SecurityFilter"",""MethodName"":
""TryFilter(RestMethodInfo methodInfo, HttpContext httpContext, LogicContext logicContext)""},
{""FileName"":"""",""LineNumber"":-1,""ClassName"":""MFWS.RestFilters.SecurityFilter"",""MethodName"":
""Filter(RestMethodInfo methodInfo, HttpContext httpContext, LogicContext logicContext, Stream& inputStream)""},
{""FileName"":"""",""LineNumber"":-1,""ClassName"":""MFWS.HttpHandlers.RestHandlerDelegate"",""MethodName"":
""GetObject(HttpContext context)""},{""FileName"":"""",""LineNumber"":-1,""ClassName"":
""MFWS.HttpHandlers.HttpHandler"",""MethodName"":""ProcessRequest(HttpContext context)""}]}
,""Stack"":""
at MFWS.RestFilters.SecurityFilter.TryFilter(RestMethodInfo methodInfo, HttpContext httpContext, LogicContext logicContext)\r\n
at MFWS.RestFilters.SecurityFilter.Filter(RestMethodInfo methodInfo, HttpContext httpContext, LogicContext logicContext, Stream& inputStream)\r\n
at MFWS.HttpHandlers.RestHandlerDelegate.GetObject(HttpContext context)\r\n
at MFWS.HttpHandlers.HttpHandler.ProcessRequest(HttpContext context)\r\n"",""Message"":""Login to vault failed"",""IsLoggedToVault"":false,""IsLoggedToApplication"":true}"