Skip to content

Commit

Permalink
POST endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Abi Lowrie <abigail.lowrie@foobarengineering.co.uk>
  • Loading branch information
Abi Lowrie authored and pedropintosilva committed Sep 5, 2022
1 parent ef8d958 commit 4c0afed
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions webapp/dotNET/WebApplication1/Controllers/FileControllers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,29 @@ public IActionResult GetFile()
var fileContent = "Hello World";
return base.Content(fileContent);
}

[HttpPost("/wopi/files/{fileId}/contents")]
// This endpoint allows for the files to save to the collabora space. This SDK example outputs in the console, or something
// {need to find this}, the body text put bellow then returns the status code 200; meaning it was a success but only if the
// body has something in, from being edited. Else it returns a failure code of 404.
public IActionResult PutFile()
{
using (StreamReader stream = new StreamReader(HttpContext.Request.Body))
{
string body = stream.ReadToEndAsync().ToString();
body = "param=somevalue&param2=someothervalue";

if (body != null)
{
System.Diagnostics.Debug.WriteLine(body);
return StatusCode(200);
}
else
{
return StatusCode(404);
}
}
}

}
}

0 comments on commit 4c0afed

Please sign in to comment.