Brightcove API "create_video" : result is null - brightcove

I have two questions about Brightcove API create_video.
The create_video API returns this JSON response below. The "result" attribute could be video_id. But what is the "id" attribute?
{"result"=>653155417001, "error=>null, "id"=>null}
Sometimes, not sure why, The API returns this JSON response below. It seems to be the request is OK but result is null... Does anyone know why?
{"result"=>null, "error=>null, "id"=>null}
FYI
http://docs.brightcove.com/en/video-cloud/media/samples/create_video.html
https://github.com/BrightcoveOS/Ruby-MAPI-Wrapper/blob/master/README.md
Thanks

The 'result' value is the video id. As the Media API uses JSON-RPC, the id in the response would match the id specified in the request, or null if there were no id. It has nothing to do with the video id.
{"method": "create_video","params": {…}, "id": 1}
{"result": 12345678900001, "error": null, "id": 1}
Brightcove's Media API doesn't require id to be specified, so there's no need to include it.
The second question would be better put to Brightcove support.

Related

mediaItems missing from Media.ListCustomerMediaItems

When sending the GET request to the following URI
https://mybusiness.googleapis.com/v4/accounts/XXXX/locations/YYYY/media/customers
i get a response that consists of 'nextPageToken' with token for next page, and 'totalMediaItemCount' which says '30' because that's the number of customer media items in the account i use.
According to the docs here:
https://developers.google.com/my-business/reference/rest/v4/accounts.locations.media.customers/list
i am supposed to get this response:
{
"mediaItems": [
{
object (MediaItem)
}
],
"totalMediaItemCount": integer,
"nextPageToken": string
}
but even though it says that i have 30 customer media items, the 'mediaItems' is missing from the response.
is there a problem with the API or am i doing something wrong?

Can't download reference attachment from MS graph API

I'm using graph API mentioned below -
"client.api(/users/${data_body.payload.originEmail}/messages/${data_body.payload.emailId}/attachments/${data_body.payload.attachmentId}/$value).getStream()"
it works fine for me if attachment type is "fileattachment" but this api is not working in case of "referenceattachment"
also I went through the documentation it says that "Attempting to get the $value of a reference attachment returns HTTP 405."
and it does not return contentBytes
enter image description here
site to refer - https://learn.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http
1: https://i.stack.imgur.com/fGrft.png
does anyone have any solution to get content data of reference attachment. if yes it would be great help !! Thanks in advance
GET /drive/items/{item-ID}?select=id,#microsoft.graph.downloadUrl
response =>
click to open
Here you can see downloadURL is missing in response
The graph v1.0 endpoint doesn't have any support for reference attachments (other then showing you that one existing on an email). You need to switch to the beta endpoint which will provide the sourceUrl of the attachment in question eg
https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/referenceattachment
eg
https://graph.microsoft.com/beta/me/mailfolders/inbox/messages/..AA=/attachments/AAM..
would give you something like
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#users('..')/mailFolders('inbox')/messages('..')/attachments/$entity",
"#odata.type": "#microsoft.graph.referenceAttachment",
"id": "..",
"lastModifiedDateTime": "2022-04-11T23:53:54Z",
"name": "User1.text",
"contentType": "application/octet-stream",
"size": 565,
"isInline": false,
"sourceUrl": "https://..-my.sharepoint.com/personal/.._com/Documents/Attachments/User1.text",
"providerType": "oneDriveBusiness",
"thumbnailUrl": null,
"previewUrl": null,
"permission": "other",
"isFolder": false
}
You then need to take the sourceURL and download that via the applicable API for the reference attachment. eg in this example its Sharepoint so you can use the SharePoint API to download the file.

Retrive additional tag info in json response

When i use get method on the below bright cove api to retrive video meta data, it generates json response with some fields.
"https://cms.api.brightcove.com/v1/accounts/510000340001/videos?sort=-updated_at&limit=1&offset=0"
How do we get additional tags which are not included, say for example 'category' field in the output json response?
I tried to append below in url and api does not detect.
?custom_field=category
If the video has a value set for that field, it will be present in the custom_fields object as below. If the field is empty, it will not be included for that video.
{
"name": "A video",
...
"custom_fields": {
"category": "something"
}
}

transfer a sibling element in a reponse to a parameter in Ready API / SOAP UI

I have one REST endpoint which returns a response like this
[
{
"id": "dbfff519-e8f6-4db3-9e26-a4e9014dc360",
"code": "123456789012345678901234567890123456789012345678901234567890",
"name": "client-code-with-character-length-sixty",
},
{
"id": "a673fb54-3503-4996-ba9b-a4e9014dc3ea",
"code": "18MTH",
"name": "18 Month",
},
{
"id": "60b781e3-4515-40f5-81ee-a4e9014dc400",
"code": "2periods",
"name": "I Have 2 Periods",
}...
etc.
I would like to be able to retrieve the ID where, for example, the code="2periods" UI can retrieve using either ResponseAsxml (with xpath) or Response with JSONPath. If I use the former I have managed to get the following to nearly retrieve my ID
//Response[1]/e[code='2periods']/id
BUT this looks like this
<id>0bc4aa5f-f8ab-4efe-b788-a4e9014dc45f</id>
And I don't know how to remove the start and end tags, the id has to be just the GUID.
I can't work out how to do something similar in the JSONPath - I've only managed to get something like
$[3].id
to work, but the order of the entities is not guaranteed in the test environment.
For ResponseAsXml using the XPath to get only the id value without <id> tag just add /text() to your actual expression:
//Response[1]/e[code='2periods']/id/text()
If you want to do the same using Response property with JSONPath try with:
$..[?(#.['code']=='2periods')].id[0]
Hope it helps,

Youtube Analytics API retrieve playlist views

I need to get the view count of a Youtube playlist, so I used this API call https://developers.google.com/youtube/analytics/v1/channel_reports#playlist-reports
I don't know what's the value to pass in filters. I tried isCurated==1;playlist==LLR14ObbzEt-fw00wGkxQznA, but it returned me this :
GET https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3DUCR14ObbzEt-fw00wGkxQznA&start-date=2006-12-01&end-date=2015-10-22&metrics=views&filters=isCurated%3D%3D1%3Bplaylist%3D%3DPL7aghK2Vb4MGM1cC2mNLCwwai_uQ7vuyD
200 OK
- Show headers -
{
"kind": "youtubeAnalytics#resultTable",
"columnHeaders": [
{
"name": "views",
"columnType": "METRIC",
"dataType": "INTEGER"
}
]
}
What is wrong?
Perhaps your playlist did not receive any views during that time frame. Keep in mind YouTube analytics only has data starting from 2/1/2014, so it could be that your playlist did not have any views during your specified time frame. I've made similar calls, and it seems that if your playlist has no data for the specified metrics YouTube will simply return an empty row instead of returning 0's.
youtube_analytics = build('youtubeAnalytics','v1', http=http)
end_date=datetime.datetime.now().strftime("%Y-%m-%d")
analytics_query_response = youtube_analytics.reports().query(ids="channel==%s"%channel_id,metrics='views,estimatedMinutesWatched,averageViewDuration,playlistStarts,viewsPerPlaylistStart,averageTimeInPlaylist',start_date='2004-01-01',end_date=end_date,filters="isCurated==1").execute()

Resources