Skip to content

PromoRepublic/canva-openapi-sdk

Repository files navigation

OpenAPIClient-php

API for building integrations with Canva via a REST api

For more information, please visit https://community.canva.dev/.

Installation & Usage

Requirements

PHP 7.4 and later. Should also work with PHP 8.0.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');




$apiInstance = new Integrations\Canva\SDK\Api\AppApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$app_id = 'app_id_example'; // string | The app id

try {
    $result = $apiInstance->getAppJwks($app_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AppApi->getAppJwks: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to https://api.canva.com/rest

Class Method HTTP request Description
AppApi getAppJwks GET /v1/apps/{appId}/jwks
AssetApi createAssetUploadJob POST /v1/asset-uploads
AssetApi deleteAsset DELETE /v1/assets/{assetId}
AssetApi getAsset GET /v1/assets/{assetId}
AssetApi getAssetUploadJob GET /v1/asset-uploads/{jobId}
AssetApi updateAsset PATCH /v1/assets/{assetId}
AutofillApi createDesignAutofillJob POST /v1/autofills
AutofillApi getDesignAutofillJob GET /v1/autofills/{jobId}
BrandTemplateApi getBrandTemplate GET /v1/brand-templates/{brandTemplateId}
BrandTemplateApi getBrandTemplateDataset GET /v1/brand-templates/{brandTemplateId}/dataset
BrandTemplateApi listBrandTemplates GET /v1/brand-templates
CommentApi createComment POST /v1/comments
CommentApi createReply POST /v1/comments/{commentId}/replies
CommentApi getComment GET /v1/designs/{designId}/comments/{commentId}
ConnectApi getSigningPublicKeys GET /v1/connect/keys
DesignApi createDesign POST /v1/designs
DesignApi getDesign GET /v1/designs/{designId}
DesignApi listDesigns GET /v1/designs
DesignImportApi createDesignImportJob POST /v1/imports
DesignImportApi getDesignImportJob GET /v1/imports/{jobId}
ExportApi createDesignExportJob POST /v1/exports
ExportApi getDesignExportJob GET /v1/exports/{exportId}
FolderApi createFolder POST /v1/folders
FolderApi deleteFolder DELETE /v1/folders/{folderId}
FolderApi getFolder GET /v1/folders/{folderId}
FolderApi listFolderItems GET /v1/folders/{folderId}/items
FolderApi moveFolderItem POST /v1/folders/move
FolderApi updateFolder PATCH /v1/folders/{folderId}
OauthApi exchangeAccessToken POST /v1/oauth/token
OauthApi introspectToken POST /v1/oauth/introspect
OauthApi revokeTokens POST /v1/oauth/revoke
UserApi getUserProfile GET /v1/users/me/profile
UserApi usersMe GET /v1/users/me

Models

Authorization

Authentication schemes defined for the API:

basicAuth

  • Type: HTTP basic authentication

oauthAuthCode

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://www.canva.com/api/oauth/authorize
  • Scopes:
    • design:content:read: View the contents of the user's designs.
    • design:meta:read: View the metadata of the user's designs.
    • design:content:write: Create designs on the user's behalf.
    • folder:read: View the metadata and contents of the user's folders, including their Projects folder.
    • folder:write: Add, move, or remove the user's folders. It also lets you edit folder metadata, such as the folder's name.
    • asset:read: View the metadata for the user's assets, such as uploaded images.
    • asset:write: Upload, update, or delete assets on the user's behalf.
    • comment:read: View the comments on the user's designs, and the associated metadata.
    • comment:write: Create comments and replies on the user's designs.
    • collaboration:event: Receive webhook notifications about events relevant to the user.
    • brandtemplate:meta:read: View the metadata of the brand templates associated with the user's brand.
    • brandtemplate:content:read: Read the content of the brand templates associated with the user's brand.
    • profile:read: Read a user's profile and account information.

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: latest
    • Generator version: 7.9.0-SNAPSHOT
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen