How to retrieve popular videos from all channels a CMS account manages? - youtube-data-api

I want to get a list of videos sorted by view count from all channels a CMS account manages.
So I tried query below on query on 'Try this api' page:
curl \
'https://youtube.googleapis.com/youtube/v3/search?part=snippet&forContentOwner=true&maxResults=25&onBehalfOfContentOwner=DqqiEGtVcyLMIocnDuJHoA&order=viewCount&type=video&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
And its response is:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"errors": [
{
"domain": "youtube.api.v3.SearchListResponse.Error",
"reason": "ERROR_UNSPECIFIED"
}
],
"status": "INTERNAL"
}
}
What am I missing here?

Related

Square Insufficient permissions to set app_fee_money when creating a payment

I used Square Oauth to obtain merchant_access_token using the scopes
CUSTOMERS_WRITE
CUSTOMERS_READ
ITEMS_WRITE
ITEMS_READ
MERCHANT_PROFILE_WRITE
MERCHANT_PROFILE_READ
ORDERS_WRITE+ORDERS_READ
PAYMENTS_WRITE
PAYMENTS_READ
PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS
from https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees
When I run the command, I get Insufficient permissions to set app_fee_money
I tried this from both the Application as well as Postman
What am I doing wrong?
curl --location --request POST 'https://connect.squareupsandbox.com/v2/payments' \
--header 'Square-Version: 2021-01-21' \
--header 'Authorization: Bearer merchant_access_token' \
--header 'Content-Type: application/json' \
--data-raw '{
"source_id": "ccof:customer-card-id-ok",
"idempotency_key": "6726cbd2-7893-4cc3-908e-c54731e9f1fe77979",
"amount_money": {
"amount": 5000,
"currency": "USD"
},
"app_fee_money": {
"amount": 1220,
"currency": "USD"
},
"customer_id": "676YFJE8CCRPZ2K7F9C155JYP8",
"location_id": "LG5CC4T0JXCX9", //Merchant location id
"order_id": "M4C0LcxaW6DNpbyxE7sLypvbFA8zb4F",
"reference_id": "M4C0LcxaW6DNpbyxE7sLypvbFA8zb4F",
"statement_description_identifier": "Organization name",
"note": "Fee note"
}'
PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS was in the code but older version of scopes without it was running, that fixed it. Thanks #sjosey

Classroom Orphaned by deleted teacher account

My predecessor was in the habit of deleting users from gsuite. This has resulted in 18 courses that I cannot figure out how to change from ACTIVE to ARCHIVED.
GET https://classroom.googleapis.com/v1/courses/#######?key=[YOUR_API_KEY] HTTP/1.1
{
"id": "#######",
"name": "Course Name",
"ownerId": "#####################",
"creationTime": "2014-01-01T00:00:00.000Z",
"updateTime": "2015-01-01T00:00:00.000Z",
"enrollmentCode": "xx#xxx#",
"courseState": "ACTIVE",
"alternateLink": "https://classroom.google.com/c/XXX#XXXxXxxx",
"teacherGroupEmail": "Course_Name_teachers_#xXxXx#domain.com",
"courseGroupEmail": "Course_Name--#xXxXx#comain.com",
"teacherFolder": {
"id": "#X#Xx#xxX#xXXxXXXX#xXxXXxxXx"
},
"guardiansEnabled": false
}
Trying to PATCH the class to ARCHIVED:
curl --request PATCH \
'https://classroom.googleapis.com/v1/courses/#######?updateMask=courseState&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"courseState":"ARCHIVED"}' \
--compressed
Returns error 500:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
It's a bug that Google seems to be aware of and has no solution at this time.
https://issuetracker.google.com/issues/36760244#comment13

Getting 404 resource not found when creating conversation in Microsoft Bot Framework

Im calling the create conversation API https://api.botframework.com/v3/conversations using curl and getting 404 Resource not found
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
"isGroup": false,
"bot": {
"id": "1247256255302317",
"name": "botname"
},
"members": [
{
"id": "969923753092546",
"name": "Users name"
}
],
"topicName": "Test topic"
}' 'https://api.botframework.com/v3/conversations'
Im also adding the Authorization header in the request. The response I get is
{ "statusCode": 404, "message": "Resource not found" }
Any idea what am I doing wrong here?
you should call with :
https://facebook.botframework.com which is serviceUrl you got from the message.
Not with 'https://api.botframework.com'.
Note : above serviceUrl is for facebook message.
Think that with each social network, there will have different serviceUrl.
I had to use https://skype.botframework.com for creating conversation for Skype bots.

Strongloop - update with ajax

I try to perform an update with ajax on my db but it's not working.
Url i tried :
http://localhost:8880/api/Tracks/update?filter{"id ": "1"}
What i get :
{
"error": {
"name": "AssertionError",
"status": 500,
"message": "The where argument must be an object",
"actual": false,
"expected": true,
"operator": "==",
"generatedMessage": false,
}
}
Thanks !
Try for this:
curl -X PUT --header "Content-Type: application/json" --header "Accept: application/json" -d "{
//your data here
}" "http://localhost:aaaa/xx/yy/%7B%22id%22%3A1%7D"

Does parse.com support batch operations for push notifications?

I am attempting to do a batch push notification request using the parse rest API.
curl -X POST
-H "X-Parse-Application-Id: redacted"
-H "X-Parse-REST-API-Key: redacted"
-H "Content-Type: application/json"
-d '{
"requests": [{
"method": "POST",
"path": "/1/push/",
"body": {
"channels": ["redacted"],
"deviceType": "ios",
"badge": 1,
"data": {
"alert": "Hello",
"badge": 1,
"key": "status"
}
}
}]
https://api.parse.com/1/batch
And am receiving the error:
{"code":107,"error":"Method 'POST' to '/1/push/' not supported in batch operations."}
You are already indicating POST in CURL. The Parse push api is not batch. Push is sent to registered devices in Parse (associated with a certificate from Apple) and those matching your push criteria. Your push message should look more like this:
curl -X POST \
-H "X-Parse-Application-Id: " \
-H "X-Parse-REST-API-Key: " \
-H "Content-Type: application/json" \
-d '{
"where": {
"channels": {
"$in": ["channel1","channel2","channel3"]
},
"deviceType": "ios"
},
"data": {
"alert": "Alert message here."
}
}' \
https://api.parse.com/1/push
There are various examples in the docs. The above is from the help forum.

Resources