Skip to content

Latest commit

 

History

History
340 lines (234 loc) · 8.66 KB

PROJECTS_API.md

File metadata and controls

340 lines (234 loc) · 8.66 KB

Projects API

For detailed usage please see examples for each method.

Get All Projects

Retrieves all projects based on search query.

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$projects = $renderforestClient->getAllProjects(
    3, // limit
    1, // offset
    true, // include API projects
    'ASC', // order
    'date', // order by
    'quick' // search
);
  • In the result the renderedQualities property is optional and present if the project is in renders queue (ongoing rend).
  • All the properties of getAllProjects function are optional.

See get all projects example

Add Project

Creates a project by given template id.

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$projectId = $renderforestClient->addProject(701); // template id
  • Also, project-data is created with the following list of initial properties: templateId, title, duration, equalizer, isLego, extendableScreens, fps, projectVersion, screens, muteSfx, currentScreenId, projectColors (optional), themeVariableName (optional), themeVariableValue (optional).
  • The "muteSfx" is false initially.
  • If template is lego ("isLego": true), then no initial screen is added and "screens" defaults to []. Otherwise, at least one screen is present.
  • The "currentScreenId" is the id of the first screen for non-lego templates & null for lego templates.
  • The "projectColors" is optional and gets value if the template has default colors. Both lego & non-lego templates might have default colors.
  • Both "themeVariableName" & "themeVariableValue" are optional and are added (both) if template has theme. Both lego & non-lego templates might have a theme.

See add project example

Get Trial Project

This endpoint retrieves a trial project. Designed to allow the user to make a project (trial - without saving) before getting logged in to get an overall idea. The data can be used later to create real project (create project, update project-data with this data).

No authorization is required for this endpoint.

<?php

require '../../vendor/autoload.php';

$trialProject = \Renderforest\ApiClient::getTrialProject(701);

See get trial project example

Get a Specific Project

Gets a specific project by project id.

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$project = $renderforestClient->getProject(16970309);

See get specific project example

Update the Project - partial update

Updates the project (partial update).

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$projectId = $renderforestClient->updateProject(
    16296675,
    'new custom title', // new custom title
);
  • Updated fields are custom title.

See update project partial example

Delete a Specific Project

Deletes a specific project by project id.

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$affectedRows = $renderforestClient->deleteSpecificProject(15747948);

See delete specific project example

Delete Specific Project Videos

Deletes specific project videos. The quality parameter is optional.

IMPORTANT: If you want to delete only a single quality video, you have to specify quality parameter, otherwise all quality videos of the project will be deleted.

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$affectedRows = $renderforestClient->deleteSpecificProjectVideos(
    16296971,
    \Renderforest\Project\RenderQuality\Entity\RenderQuality::RENDER_QUALITY_360
);

See delete specific project videos example

Apply Template Preset on the Project

Applies template preset on the project.

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$projectId = $renderforestClient->applyTemplatePresetOnProject(
    16297523,
    294
);

See apply template preset on the project example

Duplicate the Project

Duplicates the project by project id.

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$newProjectId = $renderforestClient->duplicateProject(16296675);

See duplicate project example

Render the Project

Renders the project with given quality. The possible values for the quality are: 0, 360, 720, and 1080. The watermark parameter is optional, must be in '.png' file format and have canvas size of 1920 x 1080 pixels, url length must not exceed 250 characters.

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$queueId = $renderforestClient->renderProject(
    16970309,
    \Renderforest\Project\RenderQuality\Entity\RenderQuality::RENDER_QUALITY_360,
    'https://example.com/watermark.png'
);
  • The possible values of the quality are: 0, 360, 720, and 1080.

See render project example

Get rendering status

(Coming soon)

Generate Lego Screens Previews

Generates previews for lego screens of a project.

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$projectId = 12345; // Replace with your actual project ID
$params = [
    'quality' => 0, // 0, 360, 720, 1080
    'screenIds' => [1, 2, 3], // Replace with actual screen IDs
];

$previewUrl = $renderforestClient->generateLegoScreensPreviews($projectId, $params);
  • The quality parameter is an integer:
    • 0 for video with watermark
    • 720 for video without watermark
  • The screenIds parameter is an array of screen IDs for which you want to generate previews.

See generate lego screens previews example

Cancel Lego Preview

Cancels the lego preview for specified queue IDs of a project.

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$projectId = 12345; // Replace with your actual project ID
$queueIds = [67890, 67891]; // Replace with actual queue IDs

try {
    $result = $renderforestClient->cancelLegoPreview($projectId, $queueIds);
    echo "Cancel Lego Preview Result: " . print_r($result, true) . PHP_EOL;
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
    echo "Error: " . $e->getMessage() . PHP_EOL;
}

Get Project Preview URLs

Retrieves preview URLs for a specific project.

<?php

require '../../vendor/autoload.php';

$renderforestClient = new \Renderforest\ApiClient(
    'your-api-key',
    'your-client-id'
);

$projectId = 12345; // Replace with your actual project ID
$params = [
    'quality' => 720,
];

try {
    $previewUrls = $renderforestClient->getProjectPreviewUrls($projectId, $params);
    echo "Project Preview URLs: " . PHP_EOL;
    print_r($previewUrls);
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
    echo "Error: " . $e->getMessage() . PHP_EOL;
}

⬆ back to the top