Retrive additional tag info in json response - brightcove

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"
}
}

Related

How to correlate drop down list

I have a response like below-
"distributionChannelList":[
{
"id":1,
"description":"Agency1"
},
{
"id":5,
"description":"Agency2"
},
{
"id":4,
"description":"Agency3"
},
{
"id":3,
"description":"Agency4"
}
],
"marketingTypeList":[
{
"id":1,
"description":"Type1".......
There are so many 'id' and 'description' values in my response. Agency1, Agency2.. are drop downs in my application.
So I want Jmeter to pick a different agency every time and pass in subsequent requests.
How to achieve this?
Use json extractor or reg Ex to fetch all the description with Match No. as 0 for random. Pass the Json created variable to the next request like ${varDescription}. On every run, random value will be fetched and provided to the next request.
Below snapshot is an example for regex but prefer json in your case. For fetching with json use $..description as json path expression. Repeat the same for others if required.
Hope this helps.
Update:-
Please check the below config. It will extractor 2 values in sync. But, ${cnt} should be same value. I have used counter just for demo. You can use random function to generate value between 1 to 4 and pass that variable ${rnd};${rnd}.

update a get request to elastic search in nifi

I'm trying to hit a get request on my elastic search index using JSONelastisearchprocessor in NIFI.
Now, for each flow file i have some incoming attributes, based on that i need to generate different get request and store the response somewhere.
The list of processors i'm using is as below:
Getfile (to read JSON file)
Evaluate JSON path (To extract the attributes which i want to use with every get request, PROC_INST_ID_ in this case )
JSON queryelastic search (to hit the request with the below )
PUTfile to store the response
Request body
{
"query": {
"nested": {
"path": "los",
"query": {
"bool": {
"must": [
{ "match": { "los.${proc_ins_id}":"784525" }},
{ "match": { "los._source.cibilPermission.VALUE_":"1" }}
]
}
}
}
}
}
I can't see the request being genrated and not getting any response instead i'm only getting the value of proc_ins_id as reponse in putfile. Can someone suggest some appropriate way to do this?
Attaching relevant screenshots as well for reference.
I'm assuming you are providing the request body in the Query property of JsonQueryElasticSearch. In that case, you should set the Destination property to flowfile-attribute in EvaluateJsonPath because if it is set to flowfile-content and the Query property is configured with an actual query, JsonQueryElasticSearch won't even read the content of the flowfile.
And also connect hits and original to two different processors because if you connect them to the same processor you would get the original flowfile which was updated at EvaluateJsonPath at the directory configured in PutFile. In general, people would auto-terminate the original relationships unless there is a need to have it. You may also need to have the aggregations relationship configured as well because the aggregation results are sent to that relationship.

How can I send a file with a Graphql Mutation in insomnia.rest?

I'm trying to upload an image with a graphql mutation to my server, how can I test this with insomnia.rest? the the Structured request for a Graphql Query doesn't show any field to add a file. Also, if this isn't posible with insomnia, what other alternative can I use to test something like this?
You'll want to use the "Multipart" request type. Then add the following values:
operations: The graphql mutation in the format that is sent in the request, which should look something like below. (You can get this by using the GraphQL request option and switching to multipart form and then moving the values around).
{
"query":"mutation UploadFile($file: File!) {\n addResearch(file: $file)\n}",
"variables":{ "file": null},
"operationName":"UploadFile"
}
map: { "File": ["variables.file"] }
File: The file to upload. Click the dropdown on right beside the value input and choose "File" so that you can select a file.

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()

How to correlate Docker image list with tag list both as returned by API?

One can do
curl https://index.docker.io/v1/repositories/ubuntu/images
which yields
{ {"checksum": "", "id": "76ca2fd907879906ba5c936738ccce0b577590040ac8d288f07afb3d34ae8b03"}, ... }
One can also do
curl https://index.docker.io/v1/repositories/ubuntu/tags
which yields
{ {"layer": "5ba9dab4", "name": "latest"}, {"layer": "3db9c44f", "name": "10.04"}, ... }
How can you now correlate the image IDs with the tag names? Can you rely on the order of the items? Can you get the image id from the shorthand layer id?
The layer is the first 8 characters of the image id.

Resources