Vimeo | Classic

The Vimeo extension lets you fetch Vimeo videos and display them into a field in your content type. Subsequently, while creating entries, content managers can select multiple videos at a time as the input value for that field.

This step-by-step guide explains how to create a Vimeo custom field extension for your content types in Contentstack.

Steps for Execution

  1. Get the Vimeo Access token
  2. Add the Vimeo custom field extension to your stack
  3. Use your custom field

Prerequisites

  1. Get the Vimeo Access Token

    In order to set up this extension, we need to generate the Vimeo account’s access token.
    Follow the steps below to create an app and generate a Vimeo access token.

    1. Visit the Vimeo log in page and create a new account. You can also log in using your Google, Facebook, or the suggested accounts.
    2. Once you log in, you will be on the Vimeo's Home page. Hover over the New Video tab and click on the Upload button. Add the videos of your choice and proceed to create an app in Vimeo.
      image.png
    3. Next, go to the developer’s page and click on the New app button at the top right corner.
    4. On the Create a new app page, fill in the mandatory details i.e. your App name, App description.
      You can decide if you want others to access your app besides you by selecting the appropriate option.
    5. Select the terms of service checkbox and click on Create App.
      image.png
    6. This will successfully create your app. Now open your newly created app and click on Generate Access Token under the Authentication section, from the left navigation panel.
    7. Now, select the Authenticated (you) option and under the Scopes section select the Private option. Finally, click on the Generate button to get your access token as shown below.
    8. Note down the access token, as you will need it while configuring this extension in Contentstack ( in Step 3).
  2. Additional Resource: To learn more about access token in Vimeo refer the documentation.

  3. Add the Vimeo Custom Field Extension to Your Stack

    To add the Vimeo Custom field to your stack, log in to your Contentstack account and perform the following steps:

    1. For this extension, we have created the example code. If Extensions are part of your plan, contact our Support team to get the code for the extension. You'll be provided the source code that contains the following files: 
      1. vimeo: Navigate to vimeo/build/index.html file. We will upload the code in this file in the extension source code field of our extension in the next step. 
      2. vimeo-popup: Navigate to vimeo-popup/build/index.html, upload this file as an asset in your stack by referring to the Create/Upload Assets guide. After uploading this file, make a note of the asset URL. To view the asset URL, open the asset and copy the File URL.
    2. Go to your stack, navigate to the “Settings” gear icon, and select Extensions.
    3. On the Extensions page, click on the + Add Extension button, and select Create new. If you have not added any extensions in the stack yet, click on the create a new one link as shown below.create-new-button.png
    4. In the Select Extension Type window, select Custom Field.
      Select custom fields.png
    5. On the Create New Extension page, enter values in the fields as given below:
      1. Title (required): Provide a suitable title, for example “Vimeo,” for your custom field. This title will be visible when you select the extension in the custom field in your content type.
      2. Field data type (required): Select the data type in which the input data of the field should be saved in Contentstack. In this case, select JSON.
      3. Multiple (optional): Check this field.
      4. Hosting method (required): Select Hosted by Contentstack as the hosting method for this content type.
      5. Extension source code (required): If Extensions are part of your plan, contact our Support team to get the code for the extension. Enter the downloaded extension source code here. Navigate to vimeo/build/path from the downloaded folder, copy and add the code of the index.html file here.
      6. Config Parameter: Enter the following configuration details as the extension's config parameter. 
        {
          "accessToken": <<AccessToken>>,
          "saveFullResponse": true,
          "redirectUrl": <<URL of the asset file>>
        }
        • accessToken: Add the Vimeo access token that you generated in step 1.
        • saveFullResponse: If we keep the value of this parameter to "true" then the entire video JSON response will be saved in the entry. If we keep it as "false" then only video IDs will be saved in the entry response. So you can set this parameter as per your requirement.
        • redirectUrl: The URL of the redirect.html file, which you have uploaded as an asset in the stack.
    6. Save the custom field.

    Now, let’s understand how you can start using this custom field in your content type.

  4. Use Your Custom Field

    Once you have added a custom field, you can use it in your content type like any other field. To add a custom field in your content type, perform the following steps:

    1. Create a content type and add the Custom field to it.
    2. Under Select Extension, select the “Vimeo” field that you created and set the other properties. You can add other fields as per requirements.vimeo.png
    3. Finally, click on either Save or Save and Close to save your changes.
    4. Next, create an entry for this content type, and you will see the Vimeo field in action.
    5. Click Choose Video. This displays the list of the videos. Select the video you want to add and click on Save.
    6. Select the video you want to add and click on Save.ezgif.com-gif-maker_(1).gif

Additional Resource: You can also refer to our other documents on custom video extensiona such as YouTube, Brightcove, and Ooyala.

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

^