This commit is contained in:
25
docs/snippets/csharp/api/client_extract_single_file.md
Normal file
25
docs/snippets/csharp/api/client_extract_single_file.md
Normal file
@@ -0,0 +1,25 @@
|
||||
```csharp title="C#"
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
|
||||
var client = new HttpClient();
|
||||
|
||||
using (var fileStream = File.OpenRead("document.pdf"))
|
||||
{
|
||||
using (var content = new MultipartFormDataContent())
|
||||
{
|
||||
content.Add(new StreamContent(fileStream), "files", "document.pdf");
|
||||
var response = await client.PostAsync("http://localhost:8000/extract", content);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var json = await response.Content.ReadAsStringAsync();
|
||||
Console.WriteLine(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Error: {response.StatusCode}");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user