Create external file

createExternalFile(projectReference: String!, provider: ExternalFileProvider!, input: CreateExternalFileInput!): ExternalStorageFile!

Requires project.integrations.connect.

Arguments

ArgumentTypeRequiredDescription
projectReferenceString!YesProject ID or slug. Requires project.integrations.connect through the caller's own personal provider connection.
providerExternalFileProvider!YesStorage provider accessed through the caller's own personal connection. A human caller is required; agent, run, and service-account credentials are refused.
inputCreateExternalFileInput!Yes

Input fields

input

CreateExternalFileInput

FieldTypeRequiredDescription
folderIdString!YesParent folder item ID or root.
nameString!YesCreates a new file without replacing an existing one. OneDrive and SharePoint return conflict for an existing name; Google Drive creates a new item with the same name. File name, 1-255 characters without a slash.
contentString!YesFile content, at most 10,000,000 characters as sent.
contentEncodingExternalFileContentEncodingNoutf8 (default) or base64.
mimeTypeStringNoMIME type; derived from the name when omitted.
idempotencyKeyStringNo1-128 characters without whitespace. A retry with the same key and input within 24 hours returns the first file instead of creating another.

Response

Returns ExternalStorageFile!. Open the type for its fields and nested types.

FieldTypeDescription
idID!
providerString!Provider that stores the item: onedrive, sharepoint or drive.
nameString!
pathString!
mimeTypeString!
sizeBytesFloat!
kindString!
parentIdStringProvider ID of the parent folder, or null.

All fields of ExternalStorageFile.

Types marked with ! cannot be null. Lists use [Type] notation. The type index lists all published input and response types.

Example

graphql
mutation CreateExternalFile($projectReference: String!, $provider: ExternalFileProvider!, $input: CreateExternalFileInput!) {
  createExternalFile(projectReference: $projectReference, provider: $provider, input: $input) {
    id
    name
    etag
    kind
    mimeType
  }
}
json
{
  "projectReference": "example-project",
  "provider": "drive",
  "input": {
    "folderId": "root",
    "name": "notes.txt",
    "content": "hello",
    "contentEncoding": "utf8"
  }
}