Create File API

Create file entries for downloadable resources accessible by specific user roles

Resources

Create File API

Create file entries for downloadable resources such as documentation, guides, and installers. Control access by user role for targeted distribution.

Add Resources

Create downloadable file entries.

Role Access

Control who can access files.

Easy Distribution

Manage resource downloads.


Endpoint Overview

MUTATION/graphql

Create a new file entry with title, description, URL, and role-based access control. Files are made available for download to specified user roles.

Authentication:Bearer Token
Required scopes:admin

Request Parameters

file.titleString!Required

Display title for the file.

file.urlString!Required

URL where the file can be downloaded.

file.descriptionString

Description of the file contents.

file.roles[Int]

Array of role IDs that can access this file.


GraphQL Mutation

mutation createFile($file: FileEdit!) {
  createFile(file: $file) {
    id
    title
    description
    url
    createdAt
  }
}

Variables:

{
  "file": {
    "title": "Windows VPN Client v2.5.0",
    "description": "Latest Windows desktop client with improved connection stability and new server selection interface.",
    "url": "https://downloads.example.com/vpn-client-2.5.0.exe",
    "roles": [1, 2]
  }
}

HTTP Request:

curl -X POST https://api.orbnet.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -d '{
    "query": "mutation createFile($file: FileEdit!) { createFile(file: $file) { id title url } }",
    "variables": {
      "file": {
        "title": "Windows VPN Client v2.5.0",
        "url": "https://downloads.example.com/vpn-client-2.5.0.exe"
      }
    }
  }'

Response

200File Created Successfully
{
  "data": {
    "createFile": {
      "id": "file_789",
      "title": "Windows VPN Client v2.5.0",
      "description": "Latest Windows desktop client...",
      "url": "https://downloads.example.com/vpn-client-2.5.0.exe",
      "createdAt": "2024-01-15T10:30:00Z"
    }
  }
}
400Invalid URL
{
  "errors": [
    {
      "message": "Invalid file URL format",
      "path": ["createFile"],
      "extensions": {
        "code": "INVALID_URL"
      }
    }
  ],
  "data": null
}

File Types

Applications

VPN clients and installers.

Documentation

User guides and manuals.

Configuration

Config files and profiles.

Media

Marketing and brand assets.


Best Practices

Clear Titles

Include version numbers in titles.

Describe Contents

Explain what the file contains.

Secure URLs

Use HTTPS for all file URLs.

Role Targeting

Limit access to appropriate roles.



File Hosting

This API creates a file entry pointing to an external URL. Ensure your file is uploaded and accessible at the provided URL before creating the entry.

Manage File Library

View and manage all your downloadable resources.

View Files