Currently I'm running the uber.yaml found here. I'm currently getting mismatches on the actual versus expected values:
expected:
headers:
Content-Type: application/json
actual:
statusCode: 301
headers:
server: nginx
date: Tue, 13 Dec 2016 20:32:28 GMT
content-type: text/html
content-length: 178
location: https://api.uber.com/v1/history
connection: close
age: 0
Anyone know how to fix this? I have edited the the uber.yaml to include an expected content-type as follows:
- name: Content-Type
in: header
type: string
required: true
default: application/json
The problem is that the API responds with status code 301 and Content Type text/html, but your API description says it should respond with Content Type application/json.
Related
We have a new problem when run this request: https://learn.microsoft.com/en-us/graph/api/channel-get-filesfolder?view=graph-rest-1.0&tabs=http
That is, GET /teams/{id}/channels/{id}/filesFolder
Previously, if a Team Channel was created via the API, it wasn't linked to a folder with files, until a user clicks Files in a Teams client and thus initializes it. And until it was initialized, the request would return Not Found 404.
However, since around February 25, 2021, in case the authenication uses MFA, we now get this error: Value cannot be null. Parameter name: token. But, the Authorization Token is present in the request as we verified with a traffic capture. Once you initialize the folder by clicking Files, the request starts to return valid data.
Is this a bug? Thanks.
GET https://graph.microsoft.com/v1.0/teams/.../channels/.../filesFolder?$select=id,name,webUrl,parentReference HTTP/1.1
Content-Type: application/json
User-Agent: <...>
Authorization: Bearer ...
Host: graph.microsoft.com
Connection: Keep-Alive
HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Type: application/json
request-id: ...
client-request-id: ...
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"005","RoleInstance":"AGSFE_IN_67"}}
Strict-Transport-Security: max-age=31536000
Date: Mon, 01 Mar 2021 19:38:40 GMT
Content-Length: 310
{
"error": {
"code": "BadRequest",
"message": "Value cannot be null.\r\nParameter name: token",
"innerError": {
"date": "2021-03-01T19:38:41",
"request-id": "...",
"client-request-id": "..."
}
}
}
We have Raised a Bug. We don't have ETA to share when it will be available.
I am trying to get the same report that I see through their UI by using their API.
When I specify the following metrics and dimensions the query does not work:
Metrics - views, viewerPercentage, estimatedMinutesWatched, averageViewDuration, averageViewPercentage
Dimensions - insightTrafficSourceType
However, if I trim down the metrics to just: views, estimatedMinutesWatched the query works fine.
Here's the response I get in case of error from YouTube API:
HTTP/1.1 400 Bad Request
Vary: Origin
Vary: X-Origin
Content-Type: application/json; charset=UTF-8
Date: Wed, 06 Jan 2016 09:01:17 GMT
Expires: Wed, 06 Jan 2016 09:01:17 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic,p=1
Alt-Svc: quic=":443"; ma=604800; v="30,29,28,27,26,25"
Content-Length: 461
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "The query is not supported. Check the documentation at https://developers.google.com/youtube/analytics/v1/available_reports for a list of supported queries."
}
],
"code": 400,
"message": "The query is not supported. Check the documentation at https://developers.google.com/youtube/analytics/v1/available_reports for a list of supported queries."
}
}
I've seen this error before when an invalid filter or dimension was used. I was able to duplicate this issue with the Google API Explorer and the issue went away when I removed the 'viewerPercentage' metric. This is strange since it is shown in YouTube documentation as a supported core metric: https://developers.google.com/youtube/analytics/v1/dimsmets/mets#viewerPercentage. I wasn't able to find anything in regards to it being deprecated, so I'm unsure as to the cause beyond it appearing to be a problem with the Youtube Analytics API.
I've got the initial half of an OAuth flow working with the SurveyMonkey API, but when I try to exchange the short-lived authorization code for a long-lived OAuth access token, I get an HTTP 400 response. This is step 3 of the SurveyMonkey OAuth Guide.
Here's a scrubbed version of the full exchange:
POST /oauth/token?api_key=<removed> HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 338
Content-Type: application/json; charset=utf-8
Host: api.surveymonkey.net
User-Agent: HTTPie/0.7.2
{
"client_id": "<removed>",
"client_secret": "<removed>",
"code": "dKkIJYnimBli3TMHoTdHoT-zkzkUFzfHeaWJJyPVmrYG35R5Q-jLLU-Y7Fg3BR0n3tVTQ6sAmDnwVxHXSjZVdiYTJ7u7SWbLCKgQa061bKJYXSpRhTsEL0v5GMWcMEBC2vje5UjRHp3SScFQEwIIjHKZH5raC5RQJJh.JYWEOqw8Iy-2Ds7km1zYaHGGlxqu",
"grant_type": "authorization_code",
"redirect_uri": "https://app.hubspotqa.com"
}
HTTP/1.1 400 Bad Request
Cache-Control: no-store
Connection: keep-alive
Content-Length: 96
Content-Type: application/json; charset=UTF-8
Date: Fri, 24 Jan 2014 00:05:53 GMT
SM-Request-ID: 41264d11-b93d-4f8b-ad1a-c656ccfa268b
Server: nginx
{
"error": "invalid_request",
"error_description": "Invalid POST body or Content-Type received."
}
I'm able to reproduce the exact same error using other HTTP clients as well, but I have no trouble manually getting an access token using the SurveyMonkey API console. What am I doing wrong?
Side question: the OAuth guide says that step 3 accepts a redirect_uri but the example Python guide uses redirect_url. Which is the correct parameter? Can I omit it entirely? My server certainly does not care about getting redirected anywhere.
As it turns out, the required Content-Type for this POST is form encoding – application/x-www-form-urlencoded, not JSON.
Note that the documentation does not actually say that anywhere; it's implied by the example usage of the Python requests library.
Answered :
The X-Upload-Content-Length value had a space in it.
Question :
I want to use the Youtube API to upload videos from a desktop application, in C++. I implemented the Resumable Upload, everything worked on Friday 19/07 in the afternoon, I could upload a couple of small videos, and since then I always get an error when using my app : "503 : Service Unavailable".
I found several threads treating this topic, it seems there were two solutions :
Retry the request several times in a row
Wait, it somehow works again after a while
Doing the same request again and again didn't solve it for me (I tried to do the request 5 times in a row, maybe I should do more requests ? How many ?). Here is a sample request and the response I get :
Request :
POST https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=snippet HTTP/1.1
Accept: */*
Accept-Language: xx
Authorization: Bearer MY_ACCESS_KEY
X-GData-Key: key=MY_DEV_KEY
Content-Type: application/json
X-Upload-Content-Type: video/avi
X-Upload-Content-Length: 302 080
User-Agent: SOME_PRIVATE_STUFF
Host: www.googleapis.com
Content-Length: 167
Connection: Keep-Alive
Cache-Control: no-cache
{
"snippet": {
"title": "My video title",
"description": "This is a description of my video",
"tags": ["cool", "video", "more keywords"],
"categoryId": 22
}
}
Response :
HTTP/1.1 503 Service Unavailable
Date: Fri, 26 Jul 2013 16:33:27 GMT
Server: HTTP Upload Server Built on Jul 21 2013 19:20:38 (1374459638)
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Thanks for any help, I really don't know what to do right now.
I am currently using the Youtube API for a desktop application in C++. I am trying to implement the direct upload, which requires an authentication. I naturally choose OAuth 2.0, I followed the Google example and apparently everything worked well, I've got an access token and a refresh token, without any error returned.
However, when I try to use the access token to upload a video (I put it in the Authorization : Bearer header), I get an error 401 : Unauthorized with the description Token Invalid.
I then tried to refresh the access token right before requesting the upload (which means I try to refresh right after retrieving the access token, since the two operations are consecutive in my application's flow). The access token remained unchanged : I received the same access token from the refresh request and the exchange request.
I first thought it meant an access token should be refreshed only when it expires, but it is apparently not true : using the OAuth 2.0 Playground, it seems clear that refreshing a not yet expired token works fine and gives a different access token.
Any idea on what the problem could be ? Is the 401 error linked to the fact that I am not able to refresh the token ?
Edit : Here are the request and the response as shown in Fiddler
Request :
POST http://uploads.gdata.youtube.com/feeds/api/users/default/uploads HTTP/1.1
Accept: */*
Accept-Language: xx
Authorization: Bearer MY_ACCESS_TOKEN
GData-Version: 2
X-GData-Key: key=MY_DEV_KEY
Slug: test.avi
Content-Type: multipart/related; boundary="f93dcbA3"
Pragma: no-cache
User-Agent: SOME_STUFF
Host: uploads.gdata.youtube.com
Content-Length: 23686
Connection: Keep-Alive
--f93dcbA3
Content-Type: application/atom+xml; charset=UTF-8
<?xml version="1.0"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007"><media:group><media:title type="plain">Bad Wedding Toast</media:title><media:description type="plain">I gave a bad toast at my friend's wedding.</media:description><media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People</media:category><media:keywords>toast, wedding</media:keywords></media:group></entry>
--f93dcbA3
Content-Type: video/avi
Content-Transfer-Encoding: binary
<My file binary data>
--f93dcbA3--
Response
HTTP/1.1 401 Unauthorized
X-GData-User-Country: FR
WWW-Authenticate: Bearer realm="https://accounts.google.com/o/oauth2/auth",service="youtube"
Content-Type: text/html; charset=UTF-8
Content-Length: 13
X-GUploader-UploadID: AEnB2UrVDA94Fk5VFn1ng-2q9VFOo2KifLvIEHFOxQ4m66IUSC8sRf3mo5S8UH94mLyupbfANeLQvxMPhPLo6L0wlcaguQW9CQ
Date: Wed, 17 Jul 2013 09:51:23 GMT
Server: HTTP Upload Server Built on Jul 8 2013 15:32:26 (1373322746)
Token invalid
Edit 2 : Request and response using Youtube API v3
Request :
POST /upload/youtube/v3/videos?part="snippet" HTTP/1.1
Host: www.googleapis.com
X-gdata-key: DEV_KEY
Content-length: 42190
Content-type: multipart/related; boundary="===============1679429526=="
Authorization: ACCESS_TOKEN
--===============1679429526==
Content-type: application/json
{
"snippet":
{
"title": "test"
}
}
--===============1679429526==
Content-type: video/avi
<BINARY DATA - 41984B>
--===============1679429526==--
Response :
HTTP/1.1 400 Bad Request
Content-length: 229
Via: HTTP/1.1 GWA
X-google-cache-control: remote-fetch
Server: HTTP Upload Server Built on Jul 8 2013 15:32:26 (1373322746)
Date: Wed, 17 Jul 2013 22:14:03 GMT
Content-type: application/json
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badContent",
"message": "Unsupported content with type: video/avi"
}
],
"code": 400,
"message": "Unsupported content with type: video/avi"
}
}