The article explains how I as a customer or partner can make API calls to retrieve or send data to Mediaflow.
Keys
Contact support to access the customer-specific keys needed for the connection.
Note that the current agreement affects whether work with the API is allowed or not.
Example:
client_id: e2b902ds1
client_secret: g75AhbS8sgDtysjSeysi74shxXiokSH
refresh_token: KNXRDVbtNvpA2uqQwqIaop9OPxRBXQ8
Calls to access the API:t
Make a call to the endpoint using the keys above.
URL pattern:
GET: https://customerapi.mediaflowpro.com/1/oauth2/token?grant_type=refresh_token&client_id={client_id}&client_secret={client_secret}&refresh_token={refresh_token}
Exempel:
https://customerapi.mediaflowpro.com/1/oauth2/token?grant_type=refresh_token&client_id=e2b902d1&client_secret=g75AhS8sgDtysjSeysi74shxXxiokSH&refresh_token=KNXRDVtNvpA2uqQwqIaop9OPxRBXQ8
Answer the above
In response, you get an access_token that is then used in the API calls to our documented endpoints.
Example:
{
“access_token”:"eyJhbGciOiJIUbzI1NiIsInR5cCI6IkpXcVCJ9.eyJzZXJ2IjoiMTciLCJzdWIiOiI1NDM5IiwiZXhwIjoxNTgxMzQ5NTczLCJpZGN1c3QiOiI0NjgiLCJzY29wZXMiOlsiMiIsIjkiLCI2NjAyMjAiLCIwIiwiMCJdfQ.drjHwqCD9IT-w_bB0DUp9JokK7wLPrb9_7ccrfwCGNw”,
"token_type":”Bearer",
“expires_in”:7200
}
This is JSON data. access_token here has the value:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXJ2IjoiMTcibLCJzdWIiOiI1NDM5IiwiZXhwIjoxNTgxMzQ5NTczLCJpZGN1c3QiOiI0NjgiLCJzY29wZXMiOlsiMiIsIjkiLCI2NjAyMjAiLCIwIiwiMCJdfQ.drjHwqCD9IT-w_bB0DUp9JokK7wLPrb9_7ccrfwCGNw
Data call to API
Example
The value of the variable “access_token” can then be used in, for example, the following GET calls.
GET: https://customerapi.mediaflowpro.com/1/file/latest?processed=true&page=1&per_page=4&type=image&fields=id,name,filename,hasPreview,icon,smallPreview,mediumPreview,width,height,type&access_token={access_token}
Replace the value of {access_token} with the one you received in response. You will then receive a json answer that looks like the following. The example answer below contains all the information about the last 4 uploaded images.
[
{
"id":539420,
"name":"prispall",
"filename":"prispall.jpg",
"type":{
"id":101,
"type":"image",
"description":"JPEG-bild",
"extension":"jpg"
},
"width":960,
"height":540,
"hasPreview":true,
"icon":"https://static.mediaflowpro.com/images/icon101.gif",
"smallPreview":"https://im17.inviewer.se/info/54/54ATNEZ6I4.jpg",
"mediumPreview":"https://im17.inviewer.se/skiss/54/54ATNEZ6I4.jpg"
} …
]
Upload a file
Example
POST /1/file
{
"filename": "Image01.jpg",
"filesize": 1564256,
"toFolder": FOLDERID
}
Now you get an uploadURL in response from the API. Then upload the file via xhr upload there. UploadURL works for 10 min.
{
"expiresIn": 600,
"uploadURL": "https://ftp5.inviewer.se/up/..."
}
If the user who is connected to the api key does not have the right to upload to the specified folder, you get to:
{
"status": 403,
"error": "You don´t have permission to upload to this folder"
}