I'm trying to play with the twitter API. I did the oauth process, but when trying to get the user_timeline I get an empty array (but no authentication error, the http response is 200).
Any reason why this can happen?
this is the http response I get (I removed all oauth data...)
{'status': '200', 'x-ratelimit-remaining': '337', 'content-location': u'http://api.twitter.com/1/statuses/user_timeline.json?oauth_body_hash=....', 'x-transaction': '346e76fdbb36e2d8', 'set-cookie': 'guest_id="v1:134652550000237401"; Expires=Mon, 1-Sep-2014 18:51:40 GMT; Path=/; Domain=.twitter.com, lang=en', 'expires': 'Tue, 31 Mar 1981 05:00:00 GMT', 'x-access-level': 'read-write', 'content-length': '2', 'server': 'tfe', 'last-modified': 'Sat, 01 Sep 2012 18:51:40 GMT', 'x-ratelimit-limit': '350', 'pragma': 'no-cache', 'cache-control': 'no-cache, no-store, must-revalidate, pre-check=0, post-check=0', 'date': 'Sat, 01 Sep 2012 18:51:40 GMT', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'application/json;charset=utf-8', '-content-encoding': 'gzip', 'x-ratelimit-class': 'api_identified', 'x-ratelimit-reset': '1346526376'}
but the content is just an empty array (in json format)
thanks.
this was dumb issue. the issue was that the user has no tweets, so this was empty. Hope no one spent time on this.
Related
Does anyone have an idea of creating an array and option type customfield issue ?
If anyone does have leads, please suggest some.
although i tried to do some changes around here but no luck.
(customfield_15101={"value": target_department})
----------main error---------
text: data was not an array
url: http://jira/rest/api/2/issue
response headers = {'X-AUSERNAME': 'rest_api', 'X-ASEN': 'SEN-2710437', 'X-XSS-Protection': '1; mode=block', 'Content-Security-Policy': "frame-ancestors 'self'", 'X-Content-Type-Options': 'nosniff', 'Transfer-Encoding': 'chunked', 'X-Seraph-LoginReason': 'OK', 'X-AREQUESTID': '362x28422825x1', 'X-ASESSIONID': 'xhojwj', 'Connection': 'close', 'Cache-Control': 'no-cache, no-store, no-transform', 'Date': 'Thu, 18 Aug 2022 05:02:01 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'Server': 'Apache/2.4.6 (CentOS) PHP/5.4.16', 'Content-Type': 'application/json;charset=UTF-8', 'Access-Control-Allow-Origin': '*'}
response text = {"errorMessages":[],"errors":{"Target Department/s":"data was not an array"}}
issue = JIRA_INTERFACE.create_issue(customfield_15101={"value": target_department})
jira meta for this customfield:
{"type":"array","items":"option","custom":"com.atlassian.jira.plugin.system.customfieldtypes:multiselect","customId":15101},"name":"Target Department/s","hasDefaultValue":false,"operations":["add","set","remove"],"allowedValues":[{"self":"http://jira/rest/api/2/customFieldOption/14189","value":"All Departments","id":"14189"},
although i tried to use
issue = JIRA_INTERFACE.create_issue(customfield_15101={"value":"RPM"})
but no luck
issue = JIRA_INTERFACE.create_issue(customfield_15101={u"value":u"RPM"})
whenever you try to create issue, first retrieve values and check whether the value are unicode.
Google User getting below type default image when user does not have uploaded his image.
GIDGoogleUser has GIDProfileData object which has "hasImage" boolean variable. It is always returns true.
Is there is any way we are able to know User has uploaded his profile picture or it is default set by Google through "GoogleSignIn" components.
When you do a signin with google assuming that you requested one of the profile scopes (i think) You can make a request against the userinfo endpoint
GET /oauth2/v2/userinfo HTTP/1.1
Host: www.googleapis.com
Content-length: 0
Authorization: Bearer ya29.GltcBnVqN8CQ5VpTe0qVSwYomBDGkAGtUSzvYBGti_mFKfemFjIPOE00HCOkfqMXpKVS6qUeMKgnzj2uPrxgvmBeeX4b0pDur3ttfGANCWceotLBMqFO4I47b9
This will return the public profile information that google has on the User.
HTTP/1.1 200 OK
Content-length: 313
X-xss-protection: 1; mode=block
Content-location: https://www.googleapis.com/oauth2/v2/userinfo
X-content-type-options: nosniff
Transfer-encoding: chunked
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Vary: Origin, X-Origin, Referer
Server: ESF
-content-encoding: gzip
Pragma: no-cache
Cache-control: no-cache, no-store, max-age=0, must-revalidate
Date: Thu, 22 Nov 2018 07:06:47 GMT
X-frame-options: SAMEORIGIN
Alt-svc: quic=":443"; ma=2592000; v="44,43,39,35"
Content-type: application/json; charset=UTF-8
{
"picture": "https://lh5.googleusercontent.com/-a1CWlFnA5xE/AAAAAAAAAAI/AAAAAAAAl1I/UcwPajZOuN4/photo.jpg",
"name": "Linda Lawton",
"family_name": "Lawton",
"locale": "en",
"gender": "female",
"link": "https://plus.google.com/+LindaLawton",
"given_name": "Linda",
"id": "117200475532672775346"
}
As you can see it is returning my picture. This is the picture that i beleave i have uploaded to my Google+ account. As google is discontinuing Google+ i suspect these have all been exported over to the users Google account and there must be a way to upload a picture from their.
Now If I make a request against an account where i have not uploaded an image I get
HTTP/1.1 200 OK
Content-length: 326
X-xss-protection: 1; mode=block
Content-location: https://www.googleapis.com/oauth2/v2/userinfo
X-content-type-options: nosniff
Transfer-encoding: chunked
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Vary: Origin, X-Origin, Referer
Server: ESF
-content-encoding: gzip
Pragma: no-cache
Cache-control: no-cache, no-store, max-age=0, must-revalidate
Date: Thu, 22 Nov 2018 07:11:24 GMT
X-frame-options: SAMEORIGIN
Alt-svc: quic=":443"; ma=2592000; v="44,43,39,35"
Content-type: application/json; charset=UTF-8
{
"picture": "https://lh5.googleusercontent.com/-GTTySn-WtmA/AAAAAAAAAAI/AAAAAAAAAAA/AGDgw-imFDZsZC-MaGnPIHPnh2Z95O-cSA/mo/photo.jpg",
"name": "Linda Lawton",
"family_name": "Lawton",
"locale": "da",
"link": "https://plus.google.com/108097091072786400385",
"given_name": "Linda",
"id": "108097091072786400385"
}
Which is
So even if the user has not personally uploaded an image Google creates a dummy one for them out of the first letter of their first or last name. There is no way for you to know if its a dummy image or an actual image unless you create some kind of image recognition system for detecting the dummy images.
Note: All of this was tested using oauthplayground data will be the same in IOs responses as well.
If he have not selected an image from withing your application. And there is an image that is being uploaded, then high chances are that it is an image provided by google. Just make sure to exempt place holder image when you are trying to upload.
As for checking if google returned image is a image that user uploaded or google default, I checked with different path for both type of image and see no identifier that can segregate 2 type of images.
As google is providing default profile pictures with the first letter of name it is quite difficult to identify if the profile picture is set by the user on google account or not. But if you want this any how then you can user OCR to identify if there is only one alphabet in the image retrieved from the google and that is same as the first letter of the Name of the user. Refer this link for OCR.
SwiftOCR
Thanks
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 have an Android project which has been using
channels.list
and
playlists.list
of the Youtube V3 Data Api in order to get the user watch history.
Since yestarday I cannot get channels list for my youtube account that does not have any additional channels. I know how it sounds, but this account used to have something like a default channel that had a history playlist.
My other accounts that have channels works unchanged.
So the error I get
Using API explorer:
GET
https://www.googleapis.com/youtube/v3/channels?part=contentDetails&mine=true&key={YOUR_API_KEY}
returns empty response:
200 OK
Cache-Control: private, max-age=300, must-revalidate, no-transform
Content-Encoding: gzip
Content-Length: 182
Content-Type: application/json; charset=UTF-8
Date: Tue, 12 Jan 2016 11:04:28 GMT
Etag: "oqbvhYxBE6fAXXXXXXXXXXXXXXXXXXNUdA3lh-IRNmblkc"
Expires: Tue, 12 Jan 2016 11:04:28 GMT
Server: GSE
Vary: Origin, X-Origin
{
"kind": "youtube#channelListResponse",
"etag": "\"oqbvhYxBE6fAbXXXXXXXXXXXXXXI/f7EMN1qoSm4NUdA3lh-IRNmblkc\"",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 0
},
"items": [
]
}
Any ideas?
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.