docs: add get file section for version 1
This commit is contained in:
@@ -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 %}
|
||||||
|
|||||||
Reference in New Issue
Block a user