|
| 1 | +--- |
| 2 | +title: The Video Indexer connectors with Logic App and Power Automate tutorial. |
| 3 | +description: This tutorial shows how to unlock new experiences and monetization opportunities Video Indexer connectors with Logic App and Power Automate. |
| 4 | +author: anikaz |
| 5 | +manager: johndeu |
| 6 | +ms.author: anzaman |
| 7 | +ms.service: media-services |
| 8 | +ms.subservice: video-indexer |
| 9 | +ms.topic: tutorial #Required |
| 10 | +ms.date: 05/01/2020 |
| 11 | +--- |
| 12 | + |
| 13 | +# Tutorial: use Video Indexer with Logic App and Power Automate |
| 14 | + |
| 15 | +Azure Media Services [Video Indexer v2 REST API](https://api-portal.videoindexer.ai/docs/services/Operations/operations/Delete-Video?) supports both server-to-server and client-to-server communication and enables Video Indexer users to integrate video and audio insights easily into their application logic, unlocking new experiences and monetization opportunities. |
| 16 | + |
| 17 | +To make the integration even easier, we support [Logic Apps](https://azure.microsoft.com/services/logic-apps/) and [Power Automate](https://preview.flow.microsoft.com/connectors/shared_videoindexer-v2/video-indexer-v2/) connectors that are compatible with our API. You can use the connectors to set up custom workflows to effectively index and extract insights from a large amount of video and audio files, without writing a single line of code. Furthermore, using the connectors for your integration gives you better visibility on the health of your workflow and an easy way to debug it. |
| 18 | + |
| 19 | +To help you get started quickly with the Video Indexer connectors, we will do a walkthrough of an example Logic App and Power Automate solution you can set up. |
| 20 | + |
| 21 | +In this tutorial, you learn how to: |
| 22 | + |
| 23 | +> [!div class="checklist"] |
| 24 | +> * Upload and index your video automatically |
| 25 | +> * Set up the file upload flow |
| 26 | +> * Set up the JSON extraction flow |
| 27 | +
|
| 28 | +[!INCLUDE [quickstarts-free-trial-note](../../../includes/quickstarts-free-trial-note.md)] |
| 29 | + |
| 30 | +## Prerequisites |
| 31 | + |
| 32 | +To begin, you will need to open two separate flows on either Logic Apps or Power Automate (depending on which you are using). |
| 33 | +You will also need an Video Indexer account along with access to the APIs via API key. |
| 34 | + |
| 35 | +You will also need an Azure Storage account. Keep note of the access key for your Storage account. Create two containers – one to store videos in and one to store insights generated by Video Indexer in. |
| 36 | + |
| 37 | +## Upload and index your video automatically |
| 38 | + |
| 39 | +This scenario is comprised of two different flows that work together. The first flow is triggered when a blob is added or modified in an Azure Storage account. It uploads the new file to Video Indexer with a callback URL to send a notification once the indexing operation completes. The second flow is triggered based on the callback URL and saves the extracted insights back to a JSON file in Azure Storage. This two flow approach is used to support async upload and indexing of larger files effectively. |
| 40 | + |
| 41 | +### Set up the file upload flow |
| 42 | + |
| 43 | +The first flow is triggered whenever a blob is added in your Azure Storage container. Once triggered, it will create a SAS URI that you can use to upload and index the video in Video Indexer. Start by creating the following flow. |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +To set up the first flow, you will need to provide your Video Indexer API Key and Azure Storage credentials. |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +Once you can connect to your Azure Storage and Video Indexer accounts, go to the “When a blob is added or modified) trigger and select the container that you will place your video files in. |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +Next, go to the “Create SAS URI by path” action, and select List of Files Path from the Dynamic content options. |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +Fill out [your account Location and ID](https://docs.microsoft.com/azure/cognitive-services/video-indexer/video-indexer-use-apis#location) to get the Video Indexer account token. |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +For “Upload video and index”, fill out the required parameters and Video URL. Select “Add new parameter” and select Callback URL. |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +You will leave the callback URL empty for now. You’ll add it only after finishing the second flow where the callback URL is created. |
| 70 | + |
| 71 | +You can use the default value for the other parameters or set them according to your needs. |
| 72 | + |
| 73 | +Click “Save”, and let’s move on to configure the second flow, to extract the insights once the upload and indexing is completed. |
| 74 | + |
| 75 | +## Set up the JSON extraction flow |
| 76 | + |
| 77 | +The completion of the uploading and indexing from the first flow will send an HTTP request with the correct callback URL to trigger the second flow. Then, it will retrieve the insights generated by Video Indexer. In this example, it will store the output of your indexing job in your Azure Storage. However, it is up to you what you can do with the output. |
| 78 | + |
| 79 | +Create the second flow separate from the first one. |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +To set up this flow, you will need to provide your Video Indexer API Key and Azure Storage credentials again. You will need to update the same parameters as you did for the first flow. |
| 84 | + |
| 85 | +For your trigger, you will see a HTTP POST URL field. The URL won’t be generated until after you save your flow; however, you will need the URL eventually. We will come back to this. |
| 86 | + |
| 87 | +Fill out [your account Location and ID](https://docs.microsoft.com/azure/cognitive-services/video-indexer/video-indexer-use-apis#location) to get the Video Indexer account token. |
| 88 | + |
| 89 | +Go to the “Get Video Index” action and fill out the required parameters. For Video ID, put in the following expression: triggerOutputs()['queries']['id'] |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | +This expression tells the connecter to get the Video ID from the output of your trigger. In this case, the output of your trigger will be the output of “Upload video and index” in your first trigger. |
| 94 | + |
| 95 | +Go to the “Create blob” action and select the path to the folder in which you will save the insights to. Set the name of the blob you are creating. For Blob content, put in the following expression: body(‘Get_Video_Index’) |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +This expression takes the output of the “Get Video Index” action from this flow. |
| 100 | + |
| 101 | +Click “Save flow.” |
| 102 | + |
| 103 | +Once the flow is saved, an HTTP POST URL is created in the trigger. Copy the URL from the trigger. |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | +Now, go back to the first flow and paste the URL in the “Upload video and index” action for the Callback URL parameter. |
| 108 | + |
| 109 | +Make sure both flows are saved, and you’re good to go! |
| 110 | + |
| 111 | +Try out your newly created Logic App or Power Automate solution by adding a video to your Azure blobs container, and go back a few minutes later to see that the insights appear in the destination folder. |
| 112 | + |
| 113 | +## Clean up resources |
| 114 | + |
| 115 | +After you are done with this tutorial, feel free to keep this Logic App or Power Automate solution up and running if you need. However, if you do not want to keep this running and do not want to be billed, Turn Off both of your flows if you’re using Power Automate. Disable both of the flows if you’re using Logic Apps. |
| 116 | + |
| 117 | +## Next steps |
| 118 | + |
| 119 | +This tutorial showed just one Video Indexer connectors example. You can use the Video Indexer connectors for any API call provided by Video Indexer. For example: upload and retrieve insights, translate the results, get embeddable widgets and even customize your models. Additionally, you can choose to trigger those actions based on different sources like updates to file repositories or emails sent. You can then choose to have the results update to our relevant infrastructure or application or generate any number of action items. |
| 120 | + |
| 121 | +> [!div class="nextstepaction"] |
| 122 | +> [Use the Video Indexer API](video-indexer-use-apis.md) |
0 commit comments