This document will describe how to use the REST APIs to queue two or more files to be processed in sequence.  This process requires use of SAFR REST APIs.


To start, create a feed per this guide:


https://support.safr.com/en/support/solutions/articles/69000283233-process-files-with-virgo-video-feeds

 

Note: Create as many feeds as you want to run files in parallel.  If you are on a slow machine, only create one feed.  This way the Task API will only run 1 feed in parallel.

 

One you add a feed, proceed to below to set up the POST /task API

 

Go here: https://virga.real.com/docs/index.html

 

First you need to sign into the Swagger pages so you can run API commands as follows:

  1. Click “Authorize” near top of page and enter “USER:PASSWORD” in the dialog and click “Authorize”


 

Second, we will use the GET /config/worker API to get the JSON needed for the POST /task API.

  1. Scroll down to the GET /config/worker API unde the "Configuration Query Interfaces" section.
  2. Click the "Try it out" button
  3. Scroll down and click "Execute" (no need to change any arguments)
  4. You should see output as shown below:
  5. Click the "Download" button to save the text to a local file or scroll down and copy just the feed portion and client_id as shown below:
    Your's may look different if you customized SAFR Setting when creating the feed
          "feeds": {
            "File Input": {
              "mode": "Enrolled and Stranger Monitoring",
              "name": "File Input",
              "directory": "main",
              "source": "File Input",
              "site": "DESKTOP-77JFTH0",
              "enabled": false,
              "input.stream.url": "C:\\Files\\vidoefile.mp4",
              "input.type": "file"
            }
          },
          "client-id": "Virgo-win-96FA137C"
  6. With above ready, proceed to next step.




Use the POST /task API to submit a file to be processed


  1. Scroll down to the POST /task API
  2. Click "Try it out"
  3. You should see following
  4. Insert the feed properties you got from the GET /worker/config API into the feed.  Paste in only the properties and not the surrounding curly braces.    The "resource-type" should be set to the client_id

    It should look something like this when you are done (your's may vary depending on your feed settings and the resource-type value should be set to your client_id obtained above.
    {
      "feed": {
          "mode": "Enrolled and Stranger Monitoring",
          "name": "File Input",
          "directory": "main",
          "source": "File Input",
          "site": "DESKTOP-77JFTH0",
          "enabled": false,
          "input.stream.url": "C:\\Files\\vidoefile.mp4",
          "input.type": "file"
      },
      "matching": {
          "resource-type": "Virgo-win-96FA137C",
          "tenant": "yoursafraccountname"
      }
    }
  5. Click "Execute" button

If it ran successfully, should see output like the following:



The Code "200" means it ran successfully.  The returned "task-id" could be used to check status of the job in the GET /task/<taskid> API.


This will queue a task to be run in the Video feed window.  The task will be run by the next available feed on the indicated "resource" (A resource is computer connected to the SAFR account).  The files must exist on that machine.


You can run the command multiple times with different filenames.  Each time it is run, the file is queued to be run on the next available feed.


To queue files to be processed via curl script, you can copy the curl command that is printed out when the Execute command is run and modify the filename as desired.  Above shows an example of  what that output looks like.