I am trying to search youtube videos as per here: https://developers.google.com/youtube/v3/docs/search/list
This is my request:
https://www.googleapis.com/youtube/v3/search?part=id,snippet&type=video&videoEmbeddable=true&channelId=UUUhFaUpnq31m6TNX2VKVSVA&maxResults=6&order=relevance&q=bmw&key=API_KEY
I am getting "Request contains an invalid argument."
It works if I remove channelId but this parameter is supported as per docs. I need to have this parameter because I want to narrow down search in channel.
Btw, this request works in their API panel and returns results:
curl
'https://youtube.googleapis.com/youtube/v3/search?part=id&part=snippet&channelId=UCUhFaUpnq31m6TNX2VKVSVA&maxResults=6&order=relevance&q=bmw&type=video&videoEmbeddable=true&key=[YOUR_API_KEY]'
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]'
--header 'Accept: application/json'
--compressed
Related
I have a requirement to add userId in the request body to add discussion in ADO , so any pointers how to get userId in ADO?
Use this API:
https://learn.microsoft.com/en-us/rest/api/azure/devops/graph/users/list?view=azure-devops-rest-6.0&tabs=HTTP
Sample:
curl --location --request GET 'https://vssps.dev.azure.com/<Organization Name>/_apis/graph/users?api-version=6.0-preview.1' \
--header 'Authorization: Basic <Personal Access Token>'
When we try to get all users in JIRA REST API, we get response with maxResult of 50. But the thing is that how can I know how many total users are there in total? We do not get that in either response or in header, so how to know the total?
It's returning maxResult of 50 because it is the default behaviour of the Get All Users REST API.
Have you tried passing the maxResult as a query parameter like:
curl --request GET \
--url 'https://your-domain.atlassian.net/rest/api/2/users?maxResult=100' \
--user 'email#example.com:<api_token>' \
--header 'Accept: application/json'
As mentioned in the REST API doc
I need to post a single key-value pair from a Swift iOS app using form-data.
The Postman example that was provided by the back-end developer works:
The Postman Body tab shows "SelectedCreditCard" under "KEY" and "34" under "VALUE"
The method is POST.
The Postman Headers tab shows "Content-Type" under KEY and "application/x-www-form-urlencoded" under VALUE, and an additional authorization token header.
When running from Postman I get status 400 with a JSON body that contains an "Invalid credit card" warning. This is the expected result.
When implementing this in Swift I received 415 (media not supported). I pasted the curl code generated by Postman to the Mac command line, just to see how it looks, and to my surprise I got the same result as in the iOS App.
The curl code:
curl --location --request POST 'https://stg.xxx.com/api/xxx/SavePaymentInfo' \
--header 'Authorization: Bearer xxxxxxxxxx' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--form 'SelectedCreditCard=34'
The curl result:
{"$type":"Microsoft.AspNetCore.Mvc.ProblemDetails,
Microsoft.AspNetCore.Mvc.Core",
"type":"https://tools.ietf.org/html/rfc7231#section-6.5.13",
"title":"Unsupported Media Type",
"status":415,
"traceId":"0HLTFOL7EGBUA:00000007"}%
I have also tried the generated Objective C code provided by Postman and the generated Swift code, and in all cases the result is 415. The only case in which I get the correct result (400 with an invalid card warning) is when running the post directly from Postman itself. I wonder what causes this gap.
Found the solution: in curl, instead of "Content-Type", the header name should be "Accept" (no need to specify a Content-Type)
As part of our application flow, we create default LiveBroadcasts for the users to stream too. For most of our users the default LiveBroadcasts are automatically bound to the default LiveStreams, however a few users have default LiveBroadcasts that don't bind automatically.
I attempted to bind to a non-default LiveStream (since there seems to be no way to find the default LiveStream) and I get a 403 with an error message liveBroadcastBindingNotAllowed: The binding is not allowed.
Since there is no stream bound, we are unable to stream to that LiveBroadcast and our users are getting errors. Is there any workaround or fix for this?
I have encountered a similar issue as well. When listing all broadcasts via the following:
curl \
'https://www.googleapis.com/youtube/v3/liveBroadcasts?part=id%2Csnippet%2CcontentDetails%2Cstatus&broadcastType=all&mine=true&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
Some of our users are getting more than one broadcast where snippet.defaultBroadcast is true, but only one of these persistent broadcasts actually have a valid contentDetails.boundStreamId, the others simply omit the property. For my personal account, if I change the broadcastType from all to persistent, then I'm able to get just the one true default broadcast which has a valid contentDetails.boundStreamId. Here is an example request:
curl \
'https://www.googleapis.com/youtube/v3/liveBroadcasts?part=id%2Csnippet%2CcontentDetails%2Cstatus&broadcastType=persistent&mine=true&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
I'm not sure yet if it's a fluke that it happens to choose the correct persistent broadcast. I am going to contact some of our users to help me troubleshoot this, I know of one that has at least 3 persistent broadcasts in the response from the API.
I am new to rails and i want to produce json response for iPhone app from server. I have user model where they can get the current user information after login using the token
curl -H 'Content-Type: application/json' -H 'Accept:
application/json' -X GET htt://localhost:3000/profile.json -d
"{"user" : { "auth_token" : "asjyWYeyVHDJrg746h" }}"
this provides the user information, similarly how can the user be edited or updated by passing the values that are to be changed.Please help me.
Look at Grape. Also read about respond_to :json