Is there a way to get the a video file or thumbnail for a video through the linkedin v2 api? - linkedin-api

We're able to get metadata about videos via the ugcPosts endpoint and analytics via videoAnalytics, but I'm trying to get the actual video file or a thumbnail of the video.
I'm trying hitting:
https://api.linkedin.com/v2/assets/<ID>?fields=id,recipes&oauth2_access_token=XXX&projection=(*,recipes*(*), privatePlayableStreams*(*),playableStreams*(*))
But the response doesn't have any urls in it:
{
"recipes": [
{
"recipe": "urn:li:digitalmediaRecipe:feedshare-video-captions-thumbnails",
"status": "AVAILABLE"
}
],
"id": "XXX"
}
I'm not sure if the data is not available or if I've got the projection wrong or something else.

Related

How to get duration of Youtube video through video id with API call in flutter applicaiton?

I am actually diplaying youtube vidoes information as a widget before playing them, i am getting the others info like title etc through API call, is it possible to get the videos duration using the video ID?
Yes, with YouTube Data API:
URL:
https://youtube.googleapis.com/youtube/v3/videos?part=contentDetails&id=[VIDEO_ID]&fields=items(contentDetails(duration))&key=[YOUR_API_KEY]
Example:
GET https://youtube.googleapis.com/youtube/v3/videos?part=contentDetails&id=sEVvXIQ_DLY&fields=items(contentDetails(duration))&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Result:
{
"items": [
{
"contentDetails": {
"duration": "PT38S"
}
}
]
}
Link to live example in YouTube Data API documentation.

Facebook app_insights metric keys returning 0 data

Is anyone having trouble getting Facebook metric data from the app_insights edge? Hoping to get a sanity check about the Facebook graph API. In the past we could use story_clicks, story_publishes and story_impressions to get data about our facebook app. For example we would use the request of
https://graph.facebook.com/v5.0/APP_ID/app_insights/story_publishes
to return data about our facebook application. We know the application is making posts, and the request doesn't return an error, but all we get are data points that look like this:
{
"data": [
{
"time": "2019-12-02T08:00:00+0000",
"value": "0"
}
]
}
The app_insights endpoint is still listed in the 5.0 graph api documentation, and nothing related to this seems to be listed in the changelog

How can i get a video views with Facebook API

I want to get the number of views of a video (of public pages), i
already tried /VIDEO_ID/video_insights/total_video_views/ but it's
not giving any data all i get is : { "data": [ ] }
With the new version of Facebook API (v3.2 ,v3.3 ,v4 ) it's getting
more complicated to get video insights.

Is there an API for sharing an attachment in RingCentral Glip?

I want to build an app that can monitor one Glip team for posts including screenshots and then post that message to another Glip team. I can read a post, download an attachment and repost / upload it, but is there a way to simply share an existing attachment without reposting it. This can be done in the app UI but I didn't see a share API in the Glip API Reference.
Here's the Glip API Reference which includes endpoints for creating, reading, updating and deleting posts but not sharing:
https://developers.ringcentral.com/api-reference/team-messaging
The icon for sharing is the 6th from the left in the app screenshot below.
Is there a way to do this in Glip without downloading and re-uploading the file?
To share an attachment via the Glip API, create a new post with an existing attachment.
Create Post API
The Create Post API takes an optional attachments array which references existing attachments. Both the id and type properties are required. Both properties are present in the post API response.
POST /restapi/v1.0/glip/chats/{chatId}/posts
{
"text": "Please check out this file",
"attachments": [
{
"id":"123456789",
"type":"File"
}
]
}
Ref: https://developers.ringcentral.com/api-reference/Posts/createGlipPost
Example Get Posts API
The following is an example of a post showing the attachments array with the id and type properties. The attachment URL is an AWS Presigned Object URL as shown below.
GET /restapi/v1.0/glip/chats/{chatId}/posts
{
"records": [
{
"id": "11111111",
"creatorId": "22222222",
"creationTime": "2019-08-26T21:41:56.648Z",
"lastModifiedTime": "2019-08-26T21:41:56.648Z",
"type": "TextMessage",
"chatId": "33333333",
"mentions": [],
"attachments": [
{
"id": "123456789",
"name": "sharedfile.png",
"contentUri": "https://glip-vault-1.s3.amazonaws.com/web/customer_files/44444444/testimage.png?Expires=55555555&AWSAccessKeyId=myAccessKeyId&Signature=myAWSPresignedObjectUrlSignature",
"type": "File"
}
],
"text": "Check this out!"
}
},
"navigation": {}
}
Ref: https://developers.ringcentral.com/api-reference/Posts/readGlipPosts
Sharing Permissions
Attachments can only be shared by the original poster or within the same chat. If a different user wants to share an attachment in a different team, it will be necessary to download and repost the file, generating a new attachment id.
If a different user attempts to share an attachment in a different chat, a 403 Forbidden error will be encountered:
403 Forbidden
{
"errors": [
{
"errorCode": "PST-011",
"message": "The requester must be attachment creator or attachment must belong to the requested chat."
}
]
}

URL design for GET resource in REST API for images

I have a Rest API that allows users to POST to an endpoint to upload a photo:
POST /api/photos
The response would be as follows:
{
"id": "1",
"title": "my image"
"url": "https://some_s3_url"
}
The user can then access the photo metadata through the GET endpoint
GET /api/photos/1
What is the best way to model a url for getting the content of the image url? Note that I'd like to ensure the user has the ability to access this image, so requesting the s3 bucket url directly will not work here.
I have considered doing something like:
GET /api/photos/1/content
Though that seemed hacky
first of all POST request should not return response, it could return header called location to return URI of created resource for ex. http://youer-server/api/photos/1 then in GET request for this URL you can return the json object as:
{
"id": "1",
"title": "my image",
"url": "https://some_s3_url",
"base64": .....
}
then you can encode your image as base64 and provide its content in the same object.