- Create - Start Upload Session
- Get - Get Upload Session
- Upload - Upload part of File to Upload Session
- Delete - Abort Upload Session
- Finish - Finish Upload Session
Start an Upload Session. Upload sessions are used to upload large files, use the Upload File endpoint to upload smaller files (up to 100MB). Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the file upload guide.
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/components"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
)
res, err := s.FileStorage.UploadSessions.Create(ctx, operations.FileStorageUploadSessionsAddRequest{
ServiceID: sdkgo.Pointer("salesforce"),
CreateUploadSessionRequest: components.CreateUploadSessionRequest{
Name: "Documents",
ParentFolderID: "1234",
DriveID: sdkgo.Pointer("1234"),
Size: sdkgo.Pointer[int64](1810673),
PassThrough: []components.PassThroughBody{
components.PassThroughBody{
ServiceID: "<id>",
ExtendPaths: []components.ExtendPaths{
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
},
},
components.PassThroughBody{
ServiceID: "<id>",
ExtendPaths: []components.ExtendPaths{
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
},
},
components.PassThroughBody{
ServiceID: "<id>",
ExtendPaths: []components.ExtendPaths{
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
},
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res.CreateUploadSessionResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.FileStorageUploadSessionsAddRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.FileStorageUploadSessionsAddResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.BadRequestResponse | 400 | application/json |
| apierrors.UnauthorizedResponse | 401 | application/json |
| apierrors.PaymentRequiredResponse | 402 | application/json |
| apierrors.NotFoundResponse | 404 | application/json |
| apierrors.UnprocessableResponse | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |
Get Upload Session. Use the part_size to split your file into parts. Upload the parts to the Upload part of File endpoint. Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the file upload guide.
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
)
res, err := s.FileStorage.UploadSessions.Get(ctx, operations.FileStorageUploadSessionsOneRequest{
ID: "<id>",
ServiceID: sdkgo.Pointer("salesforce"),
Fields: sdkgo.Pointer("id,updated_at"),
})
if err != nil {
log.Fatal(err)
}
if res.GetUploadSessionResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.FileStorageUploadSessionsOneRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.FileStorageUploadSessionsOneResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.BadRequestResponse | 400 | application/json |
| apierrors.UnauthorizedResponse | 401 | application/json |
| apierrors.PaymentRequiredResponse | 402 | application/json |
| apierrors.NotFoundResponse | 404 | application/json |
| apierrors.UnprocessableResponse | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |
Upload part of File to Upload Session (max 100MB). Get part_size from Get Upload Session first. Every File part (except the last one) uploaded to this endpoint should have Content-Length equal to part_size. Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the file upload guide.
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"bytes"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
)
res, err := s.FileStorage.UploadSessions.Upload(ctx, operations.FileStorageUploadSessionsUploadRequest{
ID: "<id>",
ServiceID: sdkgo.Pointer("salesforce"),
PartNumber: 0.0,
Digest: sdkgo.Pointer("sha=fpRyg5eVQletdZqEKaFlqwBXJzM="),
RequestBody: bytes.NewBuffer([]byte("<binary string>")),
})
if err != nil {
log.Fatal(err)
}
if res.UpdateUploadSessionResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.FileStorageUploadSessionsUploadRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.FileStorageUploadSessionsUploadResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.BadRequestResponse | 400 | application/json |
| apierrors.UnauthorizedResponse | 401 | application/json |
| apierrors.PaymentRequiredResponse | 402 | application/json |
| apierrors.NotFoundResponse | 404 | application/json |
| apierrors.UnprocessableResponse | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |
Abort Upload Session. Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the file upload guide.
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
)
res, err := s.FileStorage.UploadSessions.Delete(ctx, operations.FileStorageUploadSessionsDeleteRequest{
ID: "<id>",
ServiceID: sdkgo.Pointer("salesforce"),
})
if err != nil {
log.Fatal(err)
}
if res.DeleteUploadSessionResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.FileStorageUploadSessionsDeleteRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.FileStorageUploadSessionsDeleteResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.BadRequestResponse | 400 | application/json |
| apierrors.UnauthorizedResponse | 401 | application/json |
| apierrors.PaymentRequiredResponse | 402 | application/json |
| apierrors.NotFoundResponse | 404 | application/json |
| apierrors.UnprocessableResponse | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |
Finish Upload Session. Only call this endpoint after all File parts have been uploaded to Upload part of File. Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the file upload guide.
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
)
res, err := s.FileStorage.UploadSessions.Finish(ctx, operations.FileStorageUploadSessionsFinishRequest{
ID: "<id>",
ServiceID: sdkgo.Pointer("salesforce"),
Digest: sdkgo.Pointer("sha=fpRyg5eVQletdZqEKaFlqwBXJzM="),
})
if err != nil {
log.Fatal(err)
}
if res.GetFileResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.FileStorageUploadSessionsFinishRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.FileStorageUploadSessionsFinishResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.BadRequestResponse | 400 | application/json |
| apierrors.UnauthorizedResponse | 401 | application/json |
| apierrors.PaymentRequiredResponse | 402 | application/json |
| apierrors.NotFoundResponse | 404 | application/json |
| apierrors.UnprocessableResponse | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |