docs: add get file section for version 1

This commit is contained in:
Stevan Freeborn
2023-04-25 15:03:23 -05:00
parent 11aa9eba61
commit a60ae04e76
2 changed files with 74 additions and 1 deletions
@@ -1 +1,47 @@
# Get File {% #get-file %} # Get File {% #get-file %}
This endpoint allows you to retrieve a file that is held in an attachment or image field on a record in an app.
## Path Parameters
{% table %}
- Parameter Name
- Data Type
- Description
---
- appId
- `number`
- The id of the app or survey where the file is held.
---
- recordId
- `number`
- The id of the record where the file is held.
---
- fieldId
- `number`
- The id of the field where the file is held.
{% /table %}
## Query Parameters
{% table %}
- Parameter Name
- Data Type
- Description
---
- fileId
- `number`
- The id of the file to be retrieved.
{% /table %}
@@ -1,4 +1,31 @@
# Retrieve a file from a record in an app # Retrieve a file from a record in an app
{% code method="GET" heading="/Files/{appId}/{recordId}/{fieldId}" defaultLanguage="bash" } {% code method="GET" heading="/Files/{appId}/{recordId}/{fieldId}" defaultLanguage="bash" %}
```bash
curl --location 'https://api.onspring.com/v1/Files/195/1/6989?fileId=89' \
--header 'X-ApiKey: 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000'
```
```csharp
using Onspring.API.SDK.Helpers;
var httpHelper = new HttpHelper(
config.baseUrl,
config.apiKey
);
using (var result = httpHelper.GetFileFromRecord(195, 1, 6989, 89))
{
Console.WriteLine($"FileName is: {result.FileName}");
Console.WriteLine($"ContentType: {result.ContentType}");
Console.WriteLine($"ContentLength: {result.ContentLength}");
using (var fileStream = new FileStream($"C:\Users\Public\Documents\{result.FileName}", FileMode.Create))
{
result.Stream.CopyTo(fileStream);
}
}
```
{% /code %} {% /code %}