Grafana status board - json

Not sure if this is possible but we're trying to create an overall status dashboard in grafana using the singlestat panel. We used templating to group our hosts into two sites and using the packet loss value from hostalive in Icinga2. We'd like the singlestat panel to show the percentage of hosts down but sometimes we get null values. Here's the JSON from our panels:
{
"id": 2,
"title": "Host Group 2",
"span": 6,
"type": "singlestat",
"targets": [
{
"target": "icinga2.$group1.host.hostalive.perfdata.pl.value",
"refId": "A",
"hide": true
},
{
"target": "keepLastValue(averageSeries(#A))",
"refId": "B",
"textEditor": true,
"targetFull": "keepLastValue(averageSeries(icinga2.$group1.host.hostalive.perfdata.pl.value), 10000)"
}
],
"links": [],
"datasource": null,
"maxDataPoints": "",
"interval": null,
"cacheTimeout": null,
"format": "percent",
"prefix": "",
"postfix": "",
"nullText": null,
"valueMaps": [
{
"value": "null",
"op": "=",
"text": "N/A"
}
],
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"rangeMaps": [
{
"from": "null",
"to": "null",
"text": "N/A"
}
],
"mappingType": 1,
"nullPointMode": "connected",
"valueName": "current",
"prefixFontSize": "50%",
"valueFontSize": "80%",
"postfixFontSize": "50%",
"thresholds": "50, 100",
"colorBackground": true,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"sparkline": {
"show": false,
"full": false,
"lineColor": "rgb(31, 120, 193)",
"fillColor": "rgba(31, 118, 189, 0.18)"
},
"gauge": {
"show": false,
"minValue": 0,
"maxValue": 100,
"thresholdMarkers": true,
"thresholdLabels": false
}
}
The polling interval for the hosts is every ten minutes, the grafana board range is "today" and set to refresh every second.

Got it figured out with the keeplastvalue.
"targets": [
{
"hide": true,
"refId": "A",
"target": "exclude(keepLastValue(icinga2.$group1.host.hostalive.perfdata.pl.value, 144), '1-99')",
"textEditor": true
},
{
"refId": "B",
"target": "averageSeries(#A)",
"targetFull": "averageSeries(icinga2.$group1.host.hostalive.perfdata.pl.value)",
"textEditor": false
}
],

Related

How can I extract json data from snowflake

I'm working with Snowflake, and have a batch of JSON data in a variant datatype. I'm going to paste just the first entry (I hope) out of megabytes of data.
I need to figure out the SQL to extract the data elements from it.
This query:
SELECT
src:value::string AS valuest,
src:value:evaluation_forms as evaluation_forms,
src:value:evaluation_forms:evaluations as evaluations,
src:value:evaluation_forms:evaluations:channel_meta as channel_meta,
src:value:evaluations:channel_meta:agent_first_name as agent_first_name
FROM stage.intuit_quality_raw_table
retrieves JSON data in valuest, JSON data in evaluation_forms, and nulls in evaluations, channel_meta, and agent_first_name.
I suspect that that is because of the '[' characters that occur in from of the evaluations and channel_meta entries, but I just don't know how to deal with that sort of data.
I aplogize the being so long. The first entry is something over 300 lines long, and I'm afraid to try to shorten it because I fear that I will delete something important. I've already added the ending batch of stuff, which I'm also afraid that I might have messed up.
Anyway, here it is:
{"value":
{"evaluation_forms":
[ {"evaluations":
[ {"channel_meta":
{"after_call_work_time": [],
"agent_first_name": ["KATRINA"],
"agent_hung_up": [],
"agent_last_name": ["COX"],
"agent_unique_id": ["LO_00130604"],
"agent_username": [],
"alternate_call_id": [],
"audio_file_name": ["b161aa50-cda9-42e2-ad16-117a9cf08b92.wav"],
"call_direction": ["INBOUND"],
"call_id": ["b161aa50-cda9-42e2-ad16-117a9cf08b92"],
"channel_type": "Call",
"customer_id": [],
"customer_segment": [],
"disposition": [],
"disposition_time": [],
"end_at": ["2023-01-24 12:00:00"],
"file_location": ["blank"],
"handle_time": ["1824"],
"hold_time": [],
"how_call_ended": ["Transferred"],
"how_call_originated": [],
"id": "3cb5a3e5-0ab8-4a38-9f6b-4ab3b2e24351",
"ivr_options": [],
"line": ["Intuit"],
"notes": [],
"queue": ["Product Support"],
"queue_time": [],
"start_at": ["2023-01-24 12:00:00"]
"subqueue": [ "Product Support - Desktop" ],
"supplemental_field_1": ["Expert Service Score: 3"],
"supplemental_field_10": [],
"supplemental_field_2": ["Derived TNPS Score: 0"],
"supplemental_field_3": [],
"supplemental_field_4": [],
"supplemental_field_5": [],
"supplemental_field_6": [],
"supplemental_field_7": [],
"supplemental_field_8": [],
"supplemental_field_9": [],
"talk_time": ["78"],
"team_id": [],
"times_held": ["2"],
"total_time": []
},
"evaluation_list": [
{"evaluation_meta":
{"ack_info":
{"ack_init_time":
null,
"ack_status": "NOT_INITIATED",
"ack_time": null,
"dispute_raised_at": null,
"dispute_raised_by_email": null,
"dispute_resolved_at": null,
"dispute_resolved_by_email": null
},
"agent_email": "lo_00130604#liveopsnation.com",
"agent_id": "63d77af042a6982e25008bf3",
"agent_name": "KATRINA COX",
"agent_status": "ACTIVE",
"created_at": "2023-02-06T02:16:53.637Z",
"evaluation_purpose": null,
"evaluation_type": "Manual",
"evaluator_email": "info#ara-gs.com",
"evaluator_id":"63cb37e42db1035ae08285d1",
"evaluator_name": "RAMON CARPIO JR�",
"evaluator_status": "ACTIVE",
"id": "63e06221ea5e4c7202572252",
"modified_at": "2023-02-06T02:17:35.229Z",
"status": "EDITED"
},
"response": {
"comment": "",
"sections": [
{
"id": "3fe2faeb-e8bc-4a16-9fd1-49166a3eed4d",
"questions": [
{
"comment": "",
"fail": false,
"id": "4c057d99-aae7-4432-8634-6c41e4cde734",
"score_obtained": 1,
"value": "Yes"
},
{"comment": "",
"fail": false,
"id": "f23b5e63-b24c-49f7-aa46-eb7499cdf89d",
"score_obtained": 1,
"value": "Yes"
},
{"comment": "",
"fail": false,
"id": "4798443d-eaf3-46e7-bc9f-1f03ccee871a",
"score_obtained": 1,
"value": "Yes"
}],
"score_obtained": 3
},
{"id": "f5a83974-3be3-4f69-a9de-49866213b383",
"questions": [ {
"comment": "",
"fail": false,
"id": "52ec152b-fce8-464d-a8cf-b4ae82bfb5d9",
"score_obtained": 0,
"value": "N/A"
},
{"comment": "",
"fail": false,
"id": "627ce8fd-2d29-44d9-8c3d-49dfdab9f7b2",
"score_obtained": 0,
"value": "N/A"
},
{ "comment": "",
"fail": false,
"id": "a6efd5fe-42e1-4411-b197-ee715b579281",
"score_obtained": 0,
"value": "N/A"
},
{"comment": "",
"fail":false,
"id": "aea7d958-c27e-44ab-a32f-c2388b8c6aab",
"score_obtained": 1,
"value": "Yes"
},
{"comment": "",
"fail": false,
"id": "860ac0b2-c325-443d-8f91-63879d09bac8",
"score_obtained": 0,
"value": "N/A"
} ],
"score_obtained": 1
},
{"id": "6a5fa573-8dc5-4dbb-b6cd-2e01445c3b4c",
"questions": [
{"comment": "",
"fail": false,
"id": "22e2cc11-c886-4b56-8de6-e97b773de4d0",
"score_obtained": 1,
"value": "Yes"
},
{"comment": "Agent transferred call incorrectly. Another agent advised her of it then call disconnected. ",
"fail":true,
"id": "39b2ab0d-7372-408e-b8e2-886be10239de",
"score_obtained": 0,
"value": "No"}
],
"score_obtained": 1
},
{"id": "d1deed99-e8aa-49f1-8c32-079887fd6838",
"questions": [
{"comment": "",
"fail": false,
"id": "b951c53c-52b9-4a08-b3c6-70298643db22",
"score_obtained": 1,
"value": "Yes"
},
{"comment": "",
"fail": false,
"id": "2321f675-01f9-4975-b7e9-d57feb865d0e",
"score_obtained": 1,
"value": "Yes"
},
{"comment": "",
"fail": false,
"id": "6b0eb24c-f31c-41f0-85d3-56805d42284d",
"score_obtained": 1,
"value": "Yes"
},
{"comment": "",
"fail":false,
"id": "7e5e7a2e-60c0-4416-814e-fe19c9ab2361",
"score_obtained": 1,
"value": "Yes"
},
{
"comment": "",
"fail": false,
"id": "19f6ec0a-4c4c-49b6-962e-d029a0326d27",
"score_obtained": 1,
"value": "No"
} ],
"score_obtained": 5
},
{"id": "6c41a906-3d69-469d-9391-c814a6124ec1",
"questions": [
{"comment": "",
"fail": false,
"id": "d72fca9d-323d-4238-980e-c0aec746e1fc",
"score_obtained": 1,
"value": "Yes"},
{
"comment": "",
"fail": false,
"id": "d1af8d8e-6a97-4111-bad7-a64695f2c3f7",
"score_obtained": 1,
"value": "Yes"
},
{
"comment": "",
"fail":true,
"id": "c1251cb6-c3fe-4f69-bbe5-9510f150d18a",
"score_obtained": 0,
"value": "No"
}],
"score_obtained": 2
},
{
"id": "ca1c275b-1cd0-49c9-a4d7-9fd0544b4bbf",
"questions": [
{
"comment": "",
"fail": true,
"id": "4f3268ba-4e8d-46b8-a50a-69ea9de88a6a",
"score_obtained": 0,
"value": "No"
},
{
"comment": "",
"fail": true,
"id": "cb82d886-8e2c-4d4c-a8f8-b5c769bf289a",
"score_obtained": 0,
"value": "No"
},
{
"comment": "",
"fail": true,
"id": "ea9aa819-6905-4f15-a702-3713bbb033a9",
"score_obtained": 0,
"value": "No"
}
],
"score_obtained": 0
},
{
"id": "5743b6e8-ac6f-4d34-8561-f7e5191d5f37",
"questions": [
{
"comment": "",
"fail": false,
"id": "af04685e-5c73-47be-8282-493960cce3e0",
"score_obtained": 1,
"value": "Yes"
},
{
"comment": "",
"fail": false,
"id": "67b8ea9f-d481-42c2-9343-e586875e0929",
"score_obtained": 1,
"value": "Yes"
},
{
"comment": "",
"fail":false,
"id": "9fc25686-a63c-4db4-b2aa-dcf8666d2147",
"score_obtained": 1,
"value": "Yes"
},
{
"comment": "",
"fail": false,
"id": "410616c0-0d41-4322-b6a3-df11c3c28963",
"score_obtained": 1,
"value": "Yes"
},
{
"comment": "",
"fail": false,
"id": "575c978e-365d-4b83-842e-acfe41de09ae",
"score_obtained": 1,
"value": "Yes"
} ],
"score_obtained": 5
},
"id": "bced1392-24b2-404f-91be-9df6d68e0c8d",
"questions": [
{
"comment": "",
"fail": false,
"id": "e2250777-8bba-4fee-b9b4-1535b42be14c",
"score_obtained": 0,
"value": "No"
},
{
"comment": "",
"fail": false,
"id": "533281a0-63db-4af6-b41e-7b967a456332",
"score_obtained": 0,
"value": "No"
},
{
"comment": "",
"fail": false,
"id": "c9cf8f64-427b-4927-8ffb-02454e6daa43",
"score_obtained": 0,
"value": "No"
},
{
"comment": "",
"fail": false,
"id": "7c4df8ba-0d89-4703-b4fe-3e6f88c3fa76",
"score_obtained": 0,
"value": "No"
},
"comment": "",
"fail": false,
"id": "0bf1e679-a300-475e-9fb8-613317d42570",
"score_obtained": 0,
"value": "No"
},
{
"comment": "Advise agent get the link with forms update
dates to provide clients. No transfer needed to be completed. ",
" fail": false,
"id": "52ba5be6-7def-469a-a31f-7c74c86730ac",
"score_obtained": 0,
"value": ""
}
],
"score_obtained": 0
}
]},
"scores_obtained": {
"auto_fail": false,
"final_score": 17,
"grade_assigned": "Pass",
"percent_score": 77.27,
"total_bonus": 0,
"total_penalties": 0,
"total_points": 22
}
}
]
}
]}]}}
Thanks,
You can use FLATTEN function to parse nested arrays in JSON.
refer to
https://docs.snowflake.com/en/user-guide/querying-semistructured#using-the-flatten-function-to-parse-nested-arrays
To simplify, I have taken a small part of your JSON data and tested it.
CREATE OR REPLACE TABLE xyz
(
src variant
)
AS
SELECT PARSE_JSON(column1) AS src
FROM VALUES
('{"value":
{"evaluation_forms":
[ {"evaluations":
[ {"channel_meta":
{"after_call_work_time": [],
"agent_first_name": ["KATRINA"],
"agent_hung_up": [],
"agent_last_name": ["COX"]
}
} ]
} ]
}
} '
) v;
SELECT
src:value AS valuest,
src:value:evaluation_forms as evaluation_forms,
v.value:evaluations as evaluations,
ve.value:channel_meta as channel_meta,
Fn.value as agent_first_name
FROM
xyz
, LATERAL FLATTEN(INPUT => SRC:value:evaluation_forms) v
, LATERAL FLATTEN(INPUT => v.value:evaluations) ve
, LATERAL FLATTEN(INPUT => ve.value:channel_meta:agent_first_name) fn
;

Is there a way for omitting certain fields from matching array elements of JSON array of content of JSON response based on a criteria in spring boot

but it should retain the fields in other array elements which did not match the criteria.
I have json response like below
{
"content": [
{
"someId": 1498,
"someKey": {
"anotherKey": "Not Specified",
"keyOne": "",
"keyTwo": null,
"keyThree": null
},
"date": "2009-09-11",
"time": "17:14",
"location": "Not Specified"
},
{
"someId": 1498,
"someKey": {
"anotherKey": "criteria",
"keyOne": "some data",
"keyTwo": "some data for key two",
"keyThree": "some data for key three"
},
"date": "2009-09-12",
"time": "17:15",
"location": "Not Specified"
},...
],
"pageable": {
"sort": {
"sorted": false,
"unsorted": true,
"empty": true
},
"offset": 0,
"pageSize": 10,
"pageNumber": 0,
"unpaged": false,
"paged": true
},
"totalElements": 10630,
"totalPages": 1063,
"last": false,
"size": 10,
"number": 0,
"sort": {
"sorted": false,
"unsorted": true,
"empty": true
},
"first": true,
"numberOfElements": 10,
"empty": false
}
when "anotherKey" value is "criteria", the "keyOne","keyTwo","keyThree" should be omitted, else it should be retained. any solution to this? thanks in advance

How to select fields with specific value with jq

I want to select parent value where the field result is with a specific value
Here is the json i have :
{
"lde-poc-01": {
"file_|-linux-debian-login-uidmin_|-/etc/login.defs_|-replace": {
"name": "/etc/login.defs",
"changes": {},
"pchanges": {},
"result": true,
"comment": "No changes needed to be made",
"__sls__": "dev/linux/ubuntu/login",
"__run_num__": 0,
"start_time": "14:40:20.708675",
"duration": 17.447,
"__id__": "linux-debian-login-uidmin"
},
"file_|-linux-debian-login-uidmax_|-/etc/login.defs_|-replace": {
"name": "/etc/login.defs",
"changes": {},
"pchanges": {},
"result": true,
"comment": "No changes needed to be made",
"__sls__": "dev/linux/ubuntu/login",
"__run_num__": 1,
"start_time": "14:40:20.726336",
"duration": 10.614,
"__id__": "linux-debian-login-uidmax"
},
"file_|-linux-debian-login-sysuidmax_|-/etc/login.defs_|-replace": {
"name": "/etc/login.defs",
"changes": {},
"pchanges": {},
"result": true,
"comment": "No changes needed to be made",
"__sls__": "dev/linux/ubuntu/login",
"__run_num__": 2,
"start_time": "14:40:20.737165",
"duration": 10.515,
"__id__": "linux-debian-login-sysuidmax"
},
"file_|-linux-debian-login-gidmin_|-/etc/login.defs_|-replace": {
"name": "/etc/login.defs",
"changes": {},
"pchanges": {},
"result": true,
"comment": "No changes needed to be made",
"__sls__": "dev/linux/ubuntu/login",
"__run_num__": 3,
"start_time": "14:40:20.747892",
"duration": 10.201,
"__id__": "linux-debian-login-gidmin"
},
"file_|-linux-ubuntu-docker_|-/etc/apt/sources.list.d/docker.list_|-managed": {
"changes": {},
"pchanges": {},
"comment": "File /etc/apt/sources.list.d/docker.list is in the correct state",
"name": "/etc/apt/sources.list.d/docker.list",
"result": true,
"__sls__": "dev/linux/ubuntu/apt",
"__run_num__": 9,
"start_time": "14:40:20.873513",
"duration": 40.569,
"__id__": "linux-ubuntu-docker"
},
"cmd_|-linux-ubuntu-unattended-updrade-service_|-systemctl daemon-reload_|-run": {
"changes": {},
"result": false,
"duration": 0.008,
"start_time": "14:40:21.159608",
"comment": "State was not run because none of the onchanges reqs changed",
"__state_ran__": false,
"__run_num__": 20,
"__sls__": "dev/linux/ubuntu/apt"
},
"file_|-linux-ubuntu-upgrade-script-telegraf_|-/etc/telegraf/check-update.sh_|-managed": {
"changes": {},
"pchanges": {},
"comment": "File /etc/telegraf/check-update.sh is in the correct state",
"name": "/etc/telegraf/check-update.sh",
"result": true,
"__sls__": "dev/linux/ubuntu/apt",
"__run_num__": 21,
"start_time": "14:40:21.159685",
"duration": 42.313,
"__id__": "linux-ubuntu-upgrade-script-telegraf"
},
"file_|-linux-ubuntu-upgrade-telegraf_|-/etc/telegraf/telegraf.d/update.conf_|-managed": {
"changes": {},
"pchanges": {},
"comment": "File /etc/telegraf/telegraf.d/update.conf is in the correct state",
"name": "/etc/telegraf/telegraf.d/update.conf",
"result": true,
"__sls__": "dev/linux/ubuntu/apt",
"__run_num__": 22,
"start_time": "14:40:21.202254",
"duration": 51.238,
"__id__": "linux-ubuntu-upgrade-telegraf"
},
"file_|-mysoc-po-python-rm2_|-/var/tmp/mysoc-po_|-absent": {
"name": "/var/tmp/mysoc-po",
"changes": {},
"pchanges": {},
"result": false,
"comment": "File /var/tmp/mysoc-po is not present",
"__sls__": "dev/mysoc-po",
"__run_num__": 236,
"start_time": "14:40:38.161788",
"duration": 0.305,
"__id__": "mysoc-po-python-rm2"
}
}
}
I want to get the values of comment / id and the parent value like ("file_|-mysoc-po-python-rm2_|-/var/tmp/mysoc-po_|-absent") where the field result is false.
I tried to use the select function but with no success
Thanks for your help
You can use the following :
.[]
| to_entries
| map(select(.value.result == false))
| map({ name:.key, id:.value.__id__, comment:.value.comment})
map(select(criteria)) is used to discard the items of an array (or the fields of an item in this case) which do not satisfy a criteria.
to_entries is used to craft an array of key/values from an item's fields.

Extract some value from JSON using JsonPath with != condition in Jmeter

I have the following JSON and I need to get id values for instances which do not have type = Jenkins
{
"data": [
{
"id": "35002399-6fd7-40b7-b0d0-8be64e4ec09c",
"name": "94Jenkins",
"url": "http://127.0.0.1:8084",
"authProvider": false,
"siteId": "cce1b6e2-4b5d-4455-ac96-6b5d4c0d901d",
"status": {
"status": "ONLINE"
},
"instanceStateReady": true,
"instanceState": {
"#type": "InstanceStateDto",
"version": "2.60.3"
},
"adminUser": "admin1",
"hasDRConfig": false,
"managed": true,
"type": "JENKINS",
"siteName": "City",
"lastRefreshTime": "2018-04-24T09:43:01.694Z"
},
{
"id": "5cd3caf6-bac1-4f07-8793-5f124b90eaf5",
"name": "RJO",
"url": "http://test.com",
"authProvider": false,
"status": {
"status": "UNAUTHORIZED"
},
"instanceStateReady": true,
"instanceState": {
"#type": "numberOfArtifacts",
"version": "5.5.2-m002",
"licenses": {
"RJO : artrjo-m": {
"type": "ENTERPRISE",
"validThrough": "Jun 12, 2021",
"licensedTo": "Test",
"licenseHash": "asdadsdb612bda1aae745bd2a3",
"expired": false
},
"RJO : artrjo-s1": {
"type": "ENTERPRISE",
"validThrough": "Jun 12, 2021",
"licensedTo": "JFrog",
"licenseHash": "asaswca236350205a3798c0fa3",
"expired": false
}
}
},
"adminUser": "jfmc",
"hasDRConfig": false,
"managed": false,
"warnings": [
"Site is missing",
"Failed to connect to the service. Please verify that the service information provided is correct."
],
"type": "ARTIFACTORY"
},
{
"id": "0727a49a-6c95-433e-9fc5-7e5c760cc76f",
"name": "NinetyTwo",
"url": "http:127.0.0.1:8081",
"authProvider": true,
"siteId": "cce1b6e2-4b5d-4455-ac96-6b5d4c0d901d",
"status": {
"status": "ONLINE"
},
"instanceStateReady": true,
"instanceState": {
"#type": "numberOfArtifacts",
"version": "5.9.0",
"licenses": {
"NinetyTwo": {
"type": "ENTERPRISE",
"validThrough": "Dec 30, 2018",
"licensedTo": "Test",
"licenseHash": "qweqwed95f712dbabee98184da52443",
"expired": false
}
}
},
"adminUser": "admin",
"hasDRConfig": false,
"managed": true,
"type": "ARTIFACTORY",
"serviceId": "jfrt#01c7g4c7hq0dpd0qa71r8c09sj",
"siteName": "Test",
"lastRefreshTime": "2018-04-24T09:43:01.698Z"
}
]
}
And I use $..[?(#.type!='JENKINS')].id path to receive id-s which relate to the instances with type NOT JENKINS, however JSON Extractor returns me the Jenkins's id too. The question is how can I receive ids for non-jenkins instances only?
Replace your JSON path expression with the below and it should work:
$.data.[*][?(#.type != "JENKINS")].id

Can not filter results in vimeo api GET call with fields param

I am using Vimeo API, while making a get call to access a user's video I am doing
https://api.vimeo.com/users/61402929/videos?access_token=token
this is returning a json response
{
"total": 1,
"page": 1,
"per_page": 25,
"paging": {
"next": null,
"previous": null,
"first": "/users/61402929/videos?access_token=365879aad6244864dab70902890fc1a1&page=1",
"last": "/users/61402929/videos?access_token=365879aad6244864dab70902890fc1a1&page=1"
},
"data": [
{
"uri": "/videos/200383630",
"name": "Bhuvan bam _ Bb ki vines _ playing piano _ Saagar jaisi aankhon waali _ bhuvan bam live (360p_30fps_H264-96kbit_AAC)",
"description": "BB Ki Vines",
"link": "https://vimeo.com/200383630",
"duration": 59,
"width": 320,
"language": null,
"height": 320,
"embed": {
"uri": null,
"html": "<iframe src=\"https://player.vimeo.com/video/200383630?badge=0&autopause=0&player_id=0\" width=\"320\" height=\"320\" frameborder=\"0\" title=\"Bhuvan bam _ Bb ki vines _ playing piano _ Saagar jaisi aankhon waali _ bhuvan bam live (360p_30fps_H264-96kbit_AAC)\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>",
"buttons": {
"like": true,
"watchlater": true,
"share": true,
"embed": true,
"hd": false,
"fullscreen": true,
"scaling": true
},
"logos": {
"vimeo": true,
"custom": {
"active": false,
"link": null,
"sticky": false
}
},
"title": {
"name": "user",
"owner": "user",
"portrait": "user"
},
"playbar": true,
"volume": true,
"color": "00adef"
},
"created_time": "2017-01-20T17:57:04+00:00",
"modified_time": "2017-01-20T17:58:41+00:00",
"release_time": "2017-01-20T17:57:04+00:00",
"content_rating": [
"unrated"
],
"license": null,
"privacy": {
"view": "anybody",
"embed": "public",
"download": true,
"add": true,
"comments": "anybody"
},
"pictures": {
"uri": "/videos/200383630/pictures/613872508",
"active": true,
"type": "custom",
"sizes": [
{
"width": 100,
"height": 75,
"link": "https://i.vimeocdn.com/video/613872508_100x75.webp?r=pad",
"link_with_play_button": "https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F613872508_100x75.webp&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width": 200,
"height": 150,
"link": "https://i.vimeocdn.com/video/613872508_200x150.webp?r=pad",
"link_with_play_button": "https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F613872508_200x150.webp&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width": 295,
"height": 166,
"link": "https://i.vimeocdn.com/video/613872508_295x166.webp?r=pad",
"link_with_play_button": "https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F613872508_295x166.webp&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width": 640,
"height": 640,
"link": "https://i.vimeocdn.com/video/613872508_640x640.webp?r=pad",
"link_with_play_button": "https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F613872508_640x640.webp&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
},
{
"width": 960,
"height": 960,
"link": "https://i.vimeocdn.com/video/613872508_960x960.webp?r=pad",
"link_with_play_button": "https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F613872508_960x960.webp&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png"
}
],
"resource_key": "fdb74e1e2dcaf7c929cfe14240765f45f2d2a302"
},
"tags": [],
"stats": {
"plays": 0
},
"metadata": {
"connections": {
"comments": {
"uri": "/videos/200383630/comments",
"options": [
"GET",
"POST"
],
"total": 0
},
"credits": {
"uri": "/videos/200383630/credits",
"options": [
"GET",
"POST"
],
"total": 1
},
"likes": {
"uri": "/videos/200383630/likes",
"options": [
"GET"
],
"total": 0
},
"pictures": {
"uri": "/videos/200383630/pictures",
"options": [
"GET",
"POST"
],
"total": 1
},
"texttracks": {
"uri": "/videos/200383630/texttracks",
"options": [
"GET",
"POST"
],
"total": 0
},
"related": null
},
"interactions": {
"watchlater": {
"added": false,
"added_time": null,
"uri": "/users/61402929/watchlater/200383630"
}
}
},
"user": {
"uri": "/users/61402929",
"name": "Rishabh Kumar",
"link": "https://vimeo.com/user61402929",
"location": null,
"bio": null,
"created_time": "2017-01-11T16:15:43+00:00",
"account": "basic",
"pictures": null,
"websites": [],
"metadata": {
"connections": {
"activities": {
"uri": "/users/61402929/activities",
"options": [
"GET"
]
},
"albums": {
"uri": "/users/61402929/albums",
"options": [
"GET"
],
"total": 0
},
"appearances": {
"uri": "/users/61402929/appearances",
"options": [
"GET"
],
"total": 0
},
"categories": {
"uri": "/users/61402929/categories",
"options": [
"GET"
],
"total": 0
},
"channels": {
"uri": "/users/61402929/channels",
"options": [
"GET"
],
"total": 0
},
"feed": {
"uri": "/users/61402929/feed",
"options": [
"GET"
]
},
"followers": {
"uri": "/users/61402929/followers",
"options": [
"GET"
],
"total": 0
},
"following": {
"uri": "/users/61402929/following",
"options": [
"GET"
],
"total": 0
},
"groups": {
"uri": "/users/61402929/groups",
"options": [
"GET"
],
"total": 0
},
"likes": {
"uri": "/users/61402929/likes",
"options": [
"GET"
],
"total": 0
},
"moderated_channels": {
"uri": "/users/61402929/channels?filter=moderated",
"options": [
"GET"
],
"total": 0
},
"portfolios": {
"uri": "/users/61402929/portfolios",
"options": [
"GET"
],
"total": 0
},
"videos": {
"uri": "/users/61402929/videos",
"options": [
"GET"
],
"total": 1
},
"watchlater": {
"uri": "/users/61402929/watchlater",
"options": [
"GET"
],
"total": 0
},
"shared": {
"uri": "/users/61402929/shared/videos",
"options": [
"GET"
],
"total": 0
},
"pictures": {
"uri": "/users/61402929/pictures",
"options": [
"GET",
"POST"
],
"total": 0
},
"watched_videos": {
"uri": "/me/watched/videos",
"options": [
"GET"
],
"total": 0
}
}
},
"preferences": {
"videos": {
"privacy": "anybody"
}
},
"content_filter": [
"language",
"drugs",
"violence",
"nudity",
"safe",
"unrated"
],
"resource_key": "6fe192b4cb782d1341fbf3fb3d0ba04a0295236d"
},
"app": null,
"status": "available",
"resource_key": "cad1f2b7d388491329363a4936f0219fa4dfd18b",
"embed_presets": null
}
]
}
however I am only interested in fields paging, total, and some fields of data array therefore i am using filter as below
https://api.vimeo.com/users/61402929/videos?access_token=token&fields=paging,data.name,data.description,data.link,data.pictures.sizes.link
but the response of above call is
{
"total": 1,
"page": 1,
"per_page": 25,
"paging": {
"next": null,
"previous": null,
"first": "/users/61402929/videos?access_token=365879********0902890fc1a1&fields=paging%2Cdata.name%2Cdata.description%2Cdata.link%2Cdata.pictures.sizes.link&page=1",
"last": "/users/61402929/videos?access_token=365879********0902890fc1a1&fields=paging%2Cdata.name%2Cdata.description%2Cdata.link%2Cdata.pictures.sizes.link&page=1"
},
"data": [
[]
]
}
Edit: Also the response for the call
https://api.vimeo.com/users/61402929/videos?access_token=token&fields=paging
is
{
"total": 1,
"page": 1,
"per_page": 25,
"paging": {
"next": null,
"previous": null,
"first": "/users/61402929/videos?access_token=365879*********70902890fc1a1&fields=paging&page=1",
"last": "/users/61402929/videos?access_token=365879*********70902890fc1a1&fields=paging&page=1"
},
"data": [
[]
]
}
I am unable to figure out why the request is not being processed correctly.
A couple of things: First, the access token should be passed in the auth header of the request, not in the request uri as you mentioned: https://developer.vimeo.com/api/authentication#making-requests
With regards to the fields filter, the filter only applies to the keys nested under data. The paging array is always returned for requests where multiple items are returned.
So your example request should look like this:
https://api.vimeo.com/users/61402929/videos?fields=name,description,link,pictures.sizes.link
More info here: https://developer.vimeo.com/api/spec#json-filter
Hope this helps!
This is not a direct answer to this question, but in case anyone else like me ends up finding this page through search results, I have wasted a couple of hours of my life with a similar problem, wondering why the results returned by Vimeo's API were seemingly completely erratic, when dialing up the API using Laravel with this package like so:
$response = Vimeo::request('/me/albums/xxxxxxx/videos?fields=name,uri,duration,width,height,link', `['per_page' => 100], 'GET');`
After a lot of trial and error I discovered that it always seemed to miss the last field listed in the query parameter.
Anyway, the solution was to always send the request with a trailing comma! i.e.
$response = Vimeo::request('/me/albums/xxxxxxx/videos?fields=name,uri,duration,width,height,link,', `['per_page' => 100], 'GET');`
Is this an absolutely face-palmingly ridiculous requirement? Why, yes. Yes it is. But there you have it.