Skip to content

Latest commit

 

History

History
223 lines (158 loc) · 7.52 KB

PROJECTS_API.md

File metadata and controls

223 lines (158 loc) · 7.52 KB

Projects API

Get All Projects

Retrieves the projects.

const RenderforestClient = require('@renderforest/sdk-node')

const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })

Renderforest.getProjects({
  limit: 2,
  offset: 10,
  includeApiProjects: false,
  order: 'DESC',
  orderBy: 'order',
  search: ''
})
  .then(console.log) // handle the success
  .catch(console.error) // handle the error
  • The renderedQualities property is optional and present if the project is in renders queue (ongoing rend).
  • All the properties of payload object are optional.

See example

Add Project

Creates a project.

const RenderforestClient = require('@renderforest/sdk-node')

const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })

Renderforest.addProject(701)
  .then(console.log) // handle the success
  .catch(console.error) // handle the error
  • 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 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). Additionally you can get preloaded project data with particular preset of template.

No authorization is required for this endpoint.

const RenderforestClient = require('@renderforest/sdk-node')

// Just a blank project for given tempalte
RenderforestClient.getTrialProject(701)
  .then(console.log) // handle the success
  .catch(console.error) // handle the error

// Project data with preloaded preset data of given template.
RenderforestClient.getTrialProject(701, 2)
  .then(console.log) // handle the success
  .catch(console.error) // handle the error

See example

Get a Specific Project

Gets a specific project.

const RenderforestClient = require('@renderforest/sdk-node')

const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })

Renderforest.getProject(5000295)
  .then(console.log) // handle the success
  .catch(console.error) // handle the error

See example

Update the Project - partial update

Updates the project (partial update).

const RenderforestClient = require('@renderforest/sdk-node')

const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })

Renderforest.updateProjectPartial(5000658, { customTitle: 'Graduation' })
  .then(console.log) // handle the success
  .catch(console.error) // handle the error

See example

Delete a Specific Project

Deletes a specific project.

const RenderforestClient = require('@renderforest/sdk-node')

const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })

Renderforest.deleteProject(5000658)
  .then(console.log) // handle the success
  .catch(console.error) // handle the error

See 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.

const RenderforestClient = require('@renderforest/sdk-node')

const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })

Renderforest.deleteProjectVideos(4120385, 360)
  .then(console.log) // handle the success
  .catch(console.error) // handle the error

See example

Duplicate the Project

Duplicates the project.

const RenderforestClient = require('@renderforest/sdk-node')

const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })

Renderforest.duplicateProject(5000658)
  .then(console.log) // handle the success
  .catch(console.error) // handle the error

See 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.

const RenderforestClient = require('@renderforest/sdk-node')

const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })

Renderforest.renderProject(4120385, { quality: 360, watermark: 'https://example.com/watermark.png' })
  .then(console.log) // handle the success
  .catch(console.error) // handle the error

Renderforest.renderProject(4120386, { quality: 360, duration: 15, startSecond: 10 })
  .then(console.log) // handle the success
  .catch(console.error) // handle the error
  • The possible values of the quality are: 0, 360, 720, and 1080.
  • Additionally, duration and startSecond parameters can be specified as rendering options. These parameters are only applicable to visualizer projects. They will be dismissed for other projects.

See example

Get rendering status

Our rendering status method uses user's defined callback to manage rendering status percentage and uses error first callback pattern. If you want to unsubscribe from getting rendering status (before rendering finishes) then simply call unsubscribe (getRenderingStatus method returns function to unsubscribe from getting rendering status).

const RenderforestClient = require('@renderforest/sdk-node')

const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })

Renderforest.renderProject(15431416, { quality: 720 })
  .then(() => {
    const unsubscribe = Renderforest.getRenderingStatus((error, percentage) => {
      if (error) {
        console.log(error)
      }
      // take percentage from here
      console.log(percentage)
      // if you want in unsubscribe (before rendering finishes) for some reason, then simply call unsubscribe
      unsubscribe()
    })
  })

⬆ back to the top