API´s Introducción

API´s

 

Las APIS de magma video son un conjunto de funciones que según sus limitaciones de acceso se distingen 2 grupos.

API Privada

Estas son de acceso privado y sólo pueden utilizarse a traves del envío de una llave por medio del HTTP HEADER Authentication. Estas contienen las mismas funciones que la API publica y agrega funciones de control, ingesta de archivos, y estadísticas elavoradas.

API Pública

Son de acceso publico a través de llamados desde un Browser en forma directa. Están limitadas a búsquedas y no incluyen funciones administrativas. Estas APIs permiten crear en forma rápida aplicaciones web, sin necesidad de crear proxies ya que son perfectamente integrables por medio de AJAX.

Estas APIs pueden habitlitarse en el panel de control de magma y permiten realizar control de acceso a través de la verificación del dominio por medio de un HTTP HEADER de respuesta Access-Control-Allow-Origin. Este header debe configurarse usando el portal de administración.

API – Uso y consumo de cuenta

Uso

WebService URL:

http://magma.edge-americas.com/api/1.1/administration/getUsageForReportingAccount.json.php

Special Header:

 Authentication: VMAuth {api-key}

POST Variables:

{
 "reportingAccount": {optional reporting account number},
 "dateFrom": {initial date in YYYYMMDD format},
 "dateTo": {final date in YYYYMMDD format},
 "edgeAccount": {optional true|false} (spread Edge accounts; sum up Fibercorp accounts),
 "resume": {optional true|false} (sum up all accounts)
}

 

Ejemplo 1

WebService URL:

http://magma.edge-americas.com/api/1.1/vod/search.json.php

Special Header:

 Authentication: VMAuth 84c43749dfcbde1d3f9f684eb19fb465-8f3ae0f7f71cc78667e2a3f8b5ba4c

POST Variables:

{
"reportingAccount": 10003,
 "dateFrom": 20141009,
 "dateTo": 20141009
}

Resultado:

{
 "status": "ok",
 "dateFrom": "20141009",
 "dateTo": "20141009",
 "usage": {
   "live": {
   "volume": "723370.9746",
   "concurrencyPeak": "737"
  },
   "vod": {
   "volume": 0,
   "concurrencyPeak": 0,
   "storageUsage": "19774.27499004364"
  },
  "reportingAccount": "10003"
 }
}


Ejemplo 2

WebService URL:

http://magma.edge-americas.com/api/1.1/vod/search.json.php

Special Header:

 Authentication: VMAuth 84c43749dfcbde1d3f9f684eb19fb465-8f3ae0f7f71cc78667e2a3f8b5ba4c

POST Variables:

{
 "dateFrom": 20141009,
 "dateTo": 20141011,
 "resume": true
}

Resultado:

{
 "status": "ok",
 "dateFrom": "20141009",
 "dateTo": "20141011",
 "usage": {
   "20000": {
     "vod": {
       "volume": 0,
       "storageUsage": "114.82460090637208",
       "concurrencyPeak": 0
     },
     "live": {
       "volume": 0,
       "concurrencyPeak": null
     }
  },
   "20001": {
     "vod": {
       "volume": 0,
       "storageUsage": null,
       "concurrencyPeak": 0
     },
     "live": {
       "volume": 0,
       "concurrencyPeak": null
     }
  },
  "fibercorp": {
    "vod": {
      "volume": 0,
      "storageUsage": 88782.236520481,
      "concurrencyPeak": 0
    },
    "live": {
      "volume": 14251591.3187,
      "concurrencyPeak": "5795"
    }
  }
}

Ejemplo 3

WebService URL:

http://magma.edge-americas.com/api/1.1/vod/search.json.php

Special Header:

 Authentication: VMAuth 84c43749dfcbde1d3f9f684eb19fb465-8f3ae0f7f71cc78667e2a3f8b5ba4c

POST Variables:

{
 "dateFrom": 20141009,
 "dateTo": 20141011
}

Resultado:

{
 "status": "ok",
 "dateFrom": "20141009",
 "dateTo": "20141011",
 "usage": {
   "10001": {
     "vod": {
       "volume": 0,
       "storageUsage": "114.82460090637208",
       "concurrencyPeak": 0
     },
     "live": {
       "volume": 0,
       "concurrencyPeak": null
     }
  },
   "10003": {
     "vod": {
       "volume": 0,
       "storageUsage": null,
       "concurrencyPeak": 0
     },
     "live": {
       "volume": 0,
       "concurrencyPeak": null
     }
  },
  "99999": {
    "vod": {
      "volume": 0,
      "storageUsage": 88782.236520481,
      "concurrencyPeak": 0
    },
    "live": {
      "volume": 14251591.3187,
      "concurrencyPeak": "5795"
    }
  }
}

Ejemplo 4

WebService URL:

http://magma.edge-americas.com/api/1.1/vod/search.json.php

Special Header:

 Authentication: VMAuth 84c43749dfcbde1d3f9f684eb19fb465-8f3ae0f7f71cc78667e2a3f8b5ba4c

POST Variables:

{
 "dateFrom": 20141009,
 "dateTo": 20141011,
 "edgeAccount": true
}

Resultado:

{
 "status": "ok",
 "dateFrom": "20141009",
 "dateTo": "20141011",
 "usage": {
   "edge": {
     "vod": {
       "volume": 0,
       "storageUsage": 24344.018223128,
       "concurrencyPeak": 0
     },
     "live": {
       "volume": 12535812.6568,
       "concurrencyPeak": "9511"
     }
   },
   "fibercorp": {
     "vod": {
       "volume": 0,
       "storageUsage": 88782.236520481,
       "concurrencyPeak": 0
     },
     "live": {
       "volume": 14251591.3187,
       "concurrencyPeak": "5795"
     }
   }
 }
}

API – Búsqueda de videos

Uso

WebService URL:

http://magma.edge-americas.com/api/1.1/vod/search.json.php

Special Header:

 Authentication: VMAuth {api-key}

POST Variables:

{
 "q": {optional string},
 "title": true|false,
 "description": true|false,
 "hash": true|false,
 "author": true|false,
 "tags": true|false,
 "publishDate": true|false,
 "limitCount": {optional max count},
 "limitFrom": {optional start-from number}
}

 

Ejemplo

WebService URL:

http://magma.edge-americas.com/api/1.1/vod/search.json.php

Special Header:

 Authentication: VMAuth 84c43749dfcbde1d3f9f684eb19fb465-8f3ae0f7f71cc78667e2a3f8b5ba4c

POST Variables:

{
 "q": "China",
 "title": true,
 "description": false,
 "hash": false,
 "author": false,
 "tags": false,
 "publishDate": false,
 "limitCount": 20,
 "limitFrom": 10
}

Resultado:

{
 "n": 20,
 "videos": [
 {
  "id": "1209",
  "title": "La_China_Suarez_y_Fer_Dente_en_Tu_cara_me_suena_HD.flv",
  "tags": "",
  "description": "",
  "author": "",
  "storageHash": "ddfc89d697e00b4fef9c4738f4c34dd4-1415634103-3001ef257407d5a371a96dcd947c7d93",
  "customMetadata": "",
  "raId": "20044",
  "duration": "264.32",
  "status": "200",
  "width": "426",
  "height": "240",
  "publishingDate": "2014-11-10 09:41:43",
  "poster": http://vod.magma.qaotic.net/media/0/ddfc89d697e00b4fef9c4738f4c34dd4-1415634103-3001ef257407d5a371a96dcd947c7d93/poster.jpg
  }
 ]
}

API – Obtener StreamNames

Uso

WebService URL:

http://magma.edge-americas.com/api/1.1/administration/getRA.json.php

Special Header:

 Authentication: VMAuth {admin api-key}

POST Variables:

 None

 

Ejemplo

WebService URL:

http://magma.edge-americas.com/api/1.1/administration/getRA.json.php

Special Header:

 Authentication: VMAuth 84c43749dfcbde1d3f9f684eb19fb465-8f3ae0f7f71cc78667e2a3f8b5ba4c

Resultado:

{
 status: "ok"
 -streams: [
  "AGEA_CLARIN-20003",
  "agro01-20046",
  "agro02-20046",
  "agro03-20046"
  ]
}