Background: I am using cfhttp and an auth token provided to me by a vendors API to do two GET calls. The first one fails the second is successful.
Call #1 is supposed to return a list of Order ID's in JSON format.
Call #2 uses one of those Order ID's to return a full order again in JSON format.
The calls are outlined below:
Request all of the ORDER ID's
<cfhttp method="get" url="https://test-9832.APIURL.com/criminal_api//1.0/service/requests" result="orderFirst">
<cfhttpparam type="Header" name="Authorization" value="Bearer 5BDCECFBDBE4680E74C8B81A58EAC544">
</cfhttp>
Request a full order based on the same auth token and one of the Order Ids returned in the previous step:
<cfhttp method="get" url="https://test-9832.APIURL.com/criminal_api//1.0/service/requests/WB-042916-YH59Z-PL-001" result="orderFull">
<cfhttpparam type="Header" name="Authorization" value="Bearer 5BDCECFBDBE4680E74C8B81A58EAC544">
</cfhttp>
The calls are using the same exact cfhttpparam and value the only difference is the URL. The vendor mentioned they sometimes see issues if the Auth Token is double encoded. I am setting the auth token value statically at this point just to get it to work.
Below is a cfdump of what is returned in Step #1 that fails:
struct
Charset UTF-8
ErrorDetail [empty string]
Filecontent Connection Failure
Header HTTP/1.1 200 OK Connection: close Expires: Wed, 31 Dec 1969 16:00:00 PST Date: Wed, 14 Sep 2016 04:47:01 GMT Server: hws Pragma: No-cache Cache-Control: no-cache Set-Cookie: X-HR-ClientSessionId=2_12.161.115.226_1473828421271;Secure; path=/; HttpOnly Content-Type: application/json;charset=UTF-8
Mimetype application/json
Responseheader
struct
Cache-Control no-cache
Connection close
Content-Type application/json;charset=UTF-8
Date Wed, 14 Sep 2016 04:47:01 GMT
Expires Wed, 31 Dec 1969 16:00:00 PST
Explanation OK
Http_Version HTTP/1.1
Pragma No-cache
Server hws
Set-Cookie X-HR-ClientSessionId=2_12.161.115.226_1473828421271;Secure; path=/; HttpOnly
Status_Code 200
Statuscode 200 OK
Text NO
The status code is showing 200 OK but the file contents is Connection Failure.
QUESTION: Is there anything else I can add to my script to help debug or test?
Related
I'm tearing my hair out trying to get a simple PATCH API call to change a value in my table. I'm using airtable.
I have a table, named AllTitles, which contains information regarding movies. I have a field in this table called 'liked' and the aim is to assign a value 1 to this cell when the user clicks a button. So I figured and nice simple PATCH would work. I set the default value to 0. The idea being that the title is marked as being liked, so I can filter liked titles and return these to the app.
The KEY value for my table is called myid. I have added a column which calls the function RECORD ID() and this does indeed display the unique record id. I'm using bravo studio, which turns figma design into an app, and using their backend I generate the URL. The URL contains a variable at the end, you guessed it, the record id. When I copy and paste this URL into the browser bar it loads the correct record. However, I am getting a 404 error when I debug.
Request Header:
application/json, text/plain, */*
Content-Type:
application/json
user-agent:
Bravo Data/1.0
Authorization:
Bearer ***
Host:
airtable.com
Content-Length:
24
(API key is correct and GET requests are working fine)
Body of request
"fields": {
"liked": "1"
}
}
Error:
Response Header:
Wed, 25 Jan 2023 17:42:54 GMT
content-type:
text/html; charset=utf-8
content-length:
246156
connection:
close
set-cookie:
AWSALB=F+leSSpTg+mrYU4Zht2ykcCKh8q7PTwcfEPi+wMpFNAocaVY2+FM1HO+w4/Jlk27DietrhMCMPM+SgKbtOlamaShWtfbhOlE7uDJGeD77VI2eClhFgNuws5gS+Hw; Expires=Wed, 01 Feb 2023 17:42:54 GMT; Path=/AWSALBCORS=F+leSSpTg+mrYU4Zht2ykcCKh8q7PTwcfEPi+wMpFNAocaVY2+FM1HO+w4/Jlk27DietrhMCMPM+SgKbtOlamaShWtfbhOlE7uDJGeD77VI2eClhFgNuws5gS+Hw; Expires=Wed, 01 Feb 2023 17:42:54 GMT; Path=/; SameSite=None; Securebrw=brwCHhGJtay2UWLI4; path=/; expires=Thu, 25 Jan 2024 17:42:54 GMT; domain=.airtable.com; samesite=none; securelogin-status-p=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=.airtable.com; secure__Host-airtable-session=eyJzZXNzaW9uSWQiOiJzZXNDNTRZWDdkYzBqTjNRcCJ9; path=/; expires=Fri, 26 Jan 2024 17:42:54 GMT; samesite=none; secure; httponly__Host-airtable-session.sig=aXS4bLusbVBSn5HWa3ScJv3_LC0hyYkl-cD_B5101m0; path=/; expires=Fri, 26 Jan 2024 17:42:54 GMT; samesite=none; secure; httponly
server:
Tengine
strict-transport-security:
max-age=31536000; includeSubDomains; preload
x-frame-options:
SAMEORIGIN
x-xss-protection:
1; mode=block
x-content-type-options:
nosniff
content-security-policy-report-only:
style-src 'unsafe-inline' https:; block-all-mixed-content; object-src 'none'; base-uri 'none'; report-uri https://airtable.com/.csp/report; script-src 'nonce-9IaceKDUeI02' 'unsafe-inline' 'strict-dynamic' 'report-sample' https:
referrer-policy:
same-origin
etag:
W/"3c18c-skDWN0GQdQY5H9HT6YcIG4hRKIQ"
vary:
Accept-Encoding
Response Body:
"<!DOCTYPE html>\n<html style=\"overflow:auto\" lang=\"en\"><head><meta name=\"referrer\" content=\"no-referrer\"/><meta name=\"robots\" content=\"noindex\"/><meta charSet=\"utf-8\"/><meta name=\"theme-color\" content=\"#ffffff\"/><meta name=\"description\" content=\"Airtable is a low-code platform for building collaborative apps. Customize your workflow, collaborate, and achieve ambitious outcomes. Get started for free.\"/><meta name=\"apple-itunes-app\" content=\"app-id=914172636\"/><meta name=\"twitter:card\" content=\"summary_large_image\"/><meta name=\"twitter:site\" content=\"#airtable\"/><meta property=\"fb:app_id\" content=\"1457397314575627\"/><meta property=\"og:site_name\" content=\"Airtable\"/><meta property=\"og:title\" content=\"Airtable | Everyone's app platform\"/><meta property=\"og:type\" content=\"website\"/><meta property=\"og:description\" content=\"Airtable is a low-code platform for building collaborative apps. Customize your workflow, collaborate, and achieve ambitious outcomes. Get started for free.\"/><meta property=\"og:image\" content=\"https://static.airtable.com/images/oembed/airtable.png\"/><meta http-equiv=\"x-ua-compatible\" content=\"ie=edge\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/><title>Page not found - Airtable</title><script nonce=\"9IaceKDUeI02\" src=\"https://static.airtable.com/js/lib/onetrust/202211.1.0/scripttemplates/otSDKStub.js\" data-domain-script=\"2eda840d-10c3-46d7-9084-4cade1b1a306\"></script><script nonce=\"9IaceKDUeI02\" src=\"https://static.airtable.com/js/lib/onetrust/202211.1.0/consent/2eda840d-10c3-46d7-9084-4cade1b1a306/OtAutoBlock.js\"></script><link nonce=\"9IaceKDUeI02\" rel=\"stylesheet\" type=\"text/css\" href=\"/css/compiled/baymax/helpers.css?v=27c119df61346f4f-7\"/><link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"/images/favicon/baymax/apple-touch-icon.png\"/><link rel=\"icon\" type=\"image/png\" href=\"/images/favicon/baymax/favicon-32x32.png\" sizes=\"32x32\"/><link rel=\"icon\" type=\"image/png\" href=\"/images/favicon/baymax/favicon-16x16.png\" sizes=\"16x16\"/><link rel=\"manifest\" href=\"/images/favico..."
There are no query parameters set. I am at a loss as to what can be the problem when the generated URL works perfectly. It's not the most demanding JSON PATCH request in the world....
Let me preface this with: I am not a developer. I'm currently using Mulesoft to integrate several systems (application originally developed by an outsourced developer). Part of the application is to merge records that might be common across the systems. To do that, I'm using the record name and geocode for the associated address. Until the past week this was working fine. Now I'm receiving an error when this part of the application runs. The debug logs from the particular call that failed is:
[2016-10-11 16:02:06.163] DEBUG com.ning.http.client.providers.grizzly.AsyncHttpClientFilter [[tbosa-rpm].DefaultSftpConnector.receiver.01]: (t:null) REQUEST: HttpRequestPacket ( method=GET
url=/maps/api/geocode/json
query=key=[REMOVED]&address=%[REMOVED]%20[REMOVED]%20[REMOVED]%2CSPRING%20BRANCH%2CTX%22
protocol=HTTP/1.1
content-length=-1
headers=[
MULE_CORRELATION_SEQUENCE=969
MULE_CORRELATION_ID=bd4249f0-8fcb-11e6-9620-12fd3e455356
MULE_CORRELATION_GROUP_SIZE=4375
Host=maps.googleapis.com:443
User-Agent=AHC/1.0
Connection=keep-alive
Accept=*/*]
)
[2016-10-11 16:02:06.164] DEBUG org.mule.module.http.internal.HttpMessageLogger [[tbosa-rpm].DefaultSftpConnector.receiver.01]: (t:null) REQUESTER
GET /maps/api/geocode/json?key=[REMOVED]&address=%[REMOVED]%20[REMOVED]%20[REMOVED]%2CSPRING%20BRANCH%2CTX%22 HTTP/1.1
MULE_CORRELATION_SEQUENCE: 969
MULE_CORRELATION_ID: bd4249f0-8fcb-11e6-9620-12fd3e455356
MULE_CORRELATION_GROUP_SIZE: 4375
Host: maps.googleapis.com:443
User-Agent: AHC/1.0
Connection: keep-alive
Accept: */*
Content-Type: application/json; charset=UTF-8
[2016-10-11 16:02:07.684] DEBUG org.mule.module.http.internal.HttpMessageLogger [[tbosa-rpm].http.requester.GeocoderRequest.worker(1)]: (t:null) REQUESTER
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Date: Tue, 11 Oct 2016 16:02:07 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, must-revalidate
Access-Control-Allow-Origin: *
Server: mafe
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Alt-Svc: quic=":443"; ma=2592000; v="36,35,34,33,32"
Accept-Ranges: none
Vary: Accept-Language,Accept-Encoding
Transfer-Encoding: chunked
35
{
"results" : [],
"status" : "UNKNOWN_ERROR"
}
0
[2016-10-11 16:02:07.684] DEBUG com.ning.http.client.providers.grizzly.AhcEventFilter [[tbosa-rpm].http.requester.GeocoderRequest.worker(1)]: (t:null) RESPONSE: HttpResponsePacket (
status=500
reason=Internal Server Error
protocol=HTTP/1.1
content-length=-1
committed=false
headers=[
content-type=application/json; charset=UTF-8
date=Tue, 11 Oct 2016 16:02:07 GMT
pragma=no-cache
expires=Fri, 01 Jan 1990 00:00:00 GMT
cache-control=no-cache, must-revalidate
access-control-allow-origin=*
server=mafe
x-xss-protection=1; mode=block
x-frame-options=SAMEORIGIN
alt-svc=quic=":443"; ma=2592000; v="36,35,34,33,32"
accept-ranges=none
vary=Accept-Language,Accept-Encoding
transfer-encoding=chunked]
)
The problem doesn't seem to be with the geocoding API itself, as I can make a manual call for the same address without any issues. The connection is throttled, so we shouldn't be hitting up against any limits on requests per second. This is the piece of code from the application that governs the API call:
<flow name="rpm-geocode-lookup" processingStrategy="synchronous">
<set-payload value="#[payload.addressLine1],#[payload.city],#[payload.state]" doc:name="Set Location"/>
<ee:cache cachingStrategy-ref="GeocoderCachingStrategy" doc:name="Geocoder Cache">
<json:object-to-json-transformer doc:name="Object to JSON"/>
<logger level="DEBUG" category="com.tbosa.esb.rpm" message="Making call to Geocoder for #[payload]" doc:name="Not Cached"/>
<http:request config-ref="GeocoderRequest" path="/geocode/json" method="GET" doc:name="Geocoder Request">
<http:request-builder>
<http:query-param paramName="key" value="${geocoder.key}"/>
<http:query-param paramName="address" value="#[payload]"/>
</http:request-builder>
</http:request>
<json:json-to-object-transformer returnClass="java.util.Map" doc:name="JSON to Object"/>
<choice doc:name="Choice">
<when expression="#[payload.status == 'OK' || payload.results.size() > 0]">
<set-payload value="#[new java.lang.String(payload.results[0].geometry.location.lat) + payload.results[0].geometry.location.lng]" doc:name="Latitude+Longitude"/>
</when>
<otherwise>
<logger message="Geocoder did not return any results. Result: #[payload]" level="WARN" category="com.tbosa.esb.rpm" doc:name="Logger"/>
<set-payload value="''" doc:name="Blank Value"/>
</otherwise>
</choice>
<expression-component doc:name="Expression">Thread.sleep(${geocoder.throttle.delay});</expression-component>
</ee:cache>
<exception-strategy ref="EmailExceptionStrategy" doc:name="Exceptions"/>
</flow>
The application hasn't changed. We've been running it successfully for 9 months, so I'm not sure where the issue might be. I'm honestly leaning toward an issue with Mulesoft, but they're trying to tell me this is an issue with the API. Thoughts?
500 error indicates that something wrong happened on Google side during processing the request. Have you retried request after a short delay?
Try to figure out which Google IP address hits your application. You can use traceroute maps.googleapis.com and ping maps.googleapis.com from the machine where you execute your application.
If 500 error persists, I would suggest filing an issue in public issue tracker with your results from traceroute and ping, sample HTTP request that demonstrates the issue, your public IP address and your project number.
https://code.google.com/p/gmaps-api-issues/
Hope it helps!
I'm using rest request in soapUI.
I want to save the JSON request and response to a file.
How can i do it?
Request payload (JSON) is not included in the report. Only request HTTP headers are captured in the report. Please let me know if you are able to log request JSON. I am using SoapUI 5.0.0
Right click on your testSuite and select Launch TestRunner, on Launch TestRunner panel select Reports tab, on this tab check Exports all results, and select a root folder to save this results on Root Folder:. Finally click on Launch.
Then in your root folder for each request you will have a file like TestSuiteName-TestCaseName-TestStepName-nIteration-result.txt with following content:
Status: OK
Time Taken: 409
Size: 793
Timestamp: Mon Apr 07 12:47:02 CEST 2014
TestStep: Test Request
----------------- Messages ------------------------------
----------------- Properties ------------------------------
Encoding: UTF-8
Endpoint: http://myHost.com/service/service
---------------- Request ---------------------------
Request Headers: Host : XX.XXX.X.XX
Content-Length : 321
SOAPAction : "http://myAction.com"
Accept-Encoding : gzip,deflate
User-Agent : Apache-HttpClient/4.1.1 (java 1.5)
Connection : Keep-Alive
Content-Type : text/xml;charset=UTF-8
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<element/>
<element/>
</soapenv:Header>
<soapenv:Body>
...
</soapenv:Body>
</soapenv:Envelope>
---------------- Response --------------------------
Response Headers: Date : Mon, 07 Apr 2014 10:48:34 GMT
#status# : HTTP/1.1 200
Content-Length : 793
Expires : Thu, 01 Jan 1970 00:00:00 GMT
Content-Type : text/xml; charset=UTF-8
Connection : close
Server : XXXXXXXXXXXX
Cache-Control : no-cache
Pragma : no-cache
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
...
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
If you prefer to save only request and response with no additional information you can take a look on this and this.
Hope this helps,
Started getting 500 error when trying to execute gapi.client.drive.files.list, even using the API exprorer.
Authorization works fine.
request:
GET https://www.googleapis.com/drive/v2/files?key={YOUR_API_KEY}
Authorization: Bearer ZZZZZZZZZZZZZ
X-JavaScript-User-Agent: Google APIs Explorer
response:
500 Internal Server Error
cache-control: private, max-age=0
content-encoding: gzip
content-length: 66
content-type: application/json; charset=UTF-8
date: Thu, 28 Mar 2013 01:24:28 GMT
expires: Thu, 28 Mar 2013 01:24:28 GMT
server: GSE
{
"error": {
"code": 500,
"message": null
}
}
It was working yesterday.
Update
Apparently it works if I limit the result set to 19 (no query string) or 13 (q: 'root' in parents)
I guess Google developers introduced some kind of limit yesterday?
Or may be I have an invalid file entry which started chrashing the google server?
How can I investigate?
Thanks!
I'm using google api dot net client, and i'm a bit confused.
Following code returns me the entire list of a specific folder (with an Id: XXXXXXXXXXXXXXXXXXXXX).
List<File> result = new List<File>();
FilesResource.ListRequest request = service.Files.List();
request.Q = "'XXXXXXXXXXXXXXXXXXXXX' in parents";
request.MaxResults = 35;
FileList files = request.Fetch();
As example one item of this FileList is
"id": "0B5XhOfl0NZ2cZ1M1aVBPcVlTUTA",
"title": "87BC1CAE-A01C-43A1-BB21-BE3DA6D6C7DC"
If i change the query, searching for a title, i receive always an empty FileList.
List<File> result = new List<File>();
FilesResource.ListRequest request = service.Files.List();
request.Q = "title = '87BC1CAE-A01C-43A1-BB21-BE3DA6D6C7DC'";
request.MaxResults = 35;
FileList files = request.Fetch();
It does'nt matter, if the operator is '=' or 'contains', or by searching only a part of the directory name:
title contains '87BC1CAE'
I receive correct results only by searching for IDs.
Following code works flawless:
File file = service.Files.Get(fileId).Fetch();
Console.WriteLine("Title: " + file.Title);
Console.WriteLine("Description: " + file.Description);
Console.WriteLine("MIME type: " + file.MimeType);
Help please :)
#AliAfshar
Raw HTTP responses:
1st case (title = '87BC1CAE-A01C-43A1-BB21-BE3DA6D6C7DC')
request.Fetch()
TestGoogleApi.vshost.exe Information: 0 : DotNetOpenAuth, Version=4.0.0.11165, Culture=neutral, PublicKeyToken=2780ccd10d57b246 (official)
TestGoogleApi.vshost.exe Information: 0 : Preparing to send AssertionFlowMessage (2.0) message.
TestGoogleApi.vshost.exe Information: 0 : Sending AssertionFlowMessage request.
TestGoogleApi.vshost.exe Information: 0 : HTTP POST https://accounts.google.com/o/oauth2/token
TestGoogleApi.vshost.exe Information: 0 : The following required parameters were missing from the DotNetOpenAuth.OAuth2.Messages.AccessTokenFailedResponse message: {error,}
TestGoogleApi.vshost.exe Information: 0 : Received UnauthorizedResponse response.
{Google.Apis.Drive.v2.Data.FileList}
_etag: "\"Q0cVodxX8sh4vfxZTlOyWcmmc0k/vyGp6PvFo4RvsFtPoIWeCReyIC8\""
_items: Count = 0
_kind: null
_nextLink: null
_nextPageToken: null
_selfLink: null
ETag: "\"Q0cVodxX8sh4vfxZTlOyWcmmc0k/vyGp6PvFo4RvsFtPoIWeCReyIC8\""
Items: Count = 0
Kind: null
NextLink: null
NextPageToken: null
SelfLink: null
2nd case ('XXXXXXXXXXXXXXXXXXXXXX' in parents )
request.Fetch()
TestGoogleApi.vshost.exe Information: 0 : DotNetOpenAuth, Version=4.0.0.11165, Culture=neutral, PublicKeyToken=2780ccd10d57b246 (official)
TestGoogleApi.vshost.exe Information: 0 : Preparing to send AssertionFlowMessage (2.0) message.
TestGoogleApi.vshost.exe Information: 0 : Sending AssertionFlowMessage request.
TestGoogleApi.vshost.exe Information: 0 : HTTP POST https://accounts.google.com/o/oauth2/token
TestGoogleApi.vshost.exe Information: 0 : The following required parameters were missing from the DotNetOpenAuth.OAuth2.Messages.AccessTokenFailedResponse message: {error,}
TestGoogleApi.vshost.exe Information: 0 : Received UnauthorizedResponse response.
{Google.Apis.Drive.v2.Data.FileList}
_etag: "\"Q0cVodxX8sh4vfxZTlOyWcmmc0k/Jyx7utsp71-_JwU5RHnI_VZmL5o\""
_items: Count = 1575
_kind: null
_nextLink: null
_nextPageToken: null
_selfLink: null
ETag: "\"Q0cVodxX8sh4vfxZTlOyWcmmc0k/Jyx7utsp71-_JwU5RHnI_VZmL5o\""
Items: Count = 1575
Kind: null
NextLink: null
NextPageToken: null
SelfLink: null
Updated on 2013 Feb 02
Ok excuse me for delay.
i used fiddler and here is captured result:
first request:
POST https://accounts.google.com/o/oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=utf-8
User-Agent: DotNetOpenAuth/4.0.0.11165
Host: accounts.google.com
Cache-Control: no-store,no-cache
Pragma: no-cache
Content-Length: 603
Connection: Keep-Alive
grant_type=assertion&assertion_type=http%3A%2F%2Foauth.net%2Fgrant_type%2Fjwt%2F1.0%2Fbearer&assertion=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI0MjYwNjE5OTE1NzktYXEzMHBhcmVsYmpsb3BrMjlqcXFvdjhsdWhic2o3YjdAZGV2ZWxvcGVyLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJzY29wZSI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL2F1dGgvZHJpdmUiLCJhdWQiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20vby9vYXV0aDIvdG9rZW4iLCJleHAiOjEzNjAwNjA0NDMsImlhdCI6MTM2MDA1Njg0M30.dk7Vdu-................-LIw0sFrVko-VWL7-elhz59VQcU_.........
first answer:
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Tue, 05 Feb 2013 09:34:03 GMT
Content-Type: application/json
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Content-Length: 128
{
"access_token" : "ya29.AHES6ZS-...........-a8HRHfMZ-NxXekx",
"token_type" : "Bearer",
"expires_in" : 3600
}
second request:
GET https://www.googleapis.com/drive/v2/files?alt=json&fields=items(id%2Ctitle)%2CnextPageToken&prettyPrint=true&maxResults=2000&q=title%20%3D%20'87BC1CAE-A01C-43A1-BB21-BE3DA6D6C7DC' HTTP/1.1
Authorization: Bearer ya29.AHES6ZS-...........-a8HRHfMZ-NxXekx
Content-Type: application/json; charset=utf-8
User-Agent: TestGoogleApi google-api-dotnet-client/ Win32NT/6.1.7600.0 (gzip)
Host: www.googleapis.com
Accept-Encoding: gzip, deflate
second answer:
HTTP/1.1 200 OK
Expires: Tue, 05 Feb 2013 09:34:04 GMT
Date: Tue, 05 Feb 2013 09:34:04 GMT
Cache-Control: private, max-age=0, must-revalidate, no-transform
ETag: "Q0cVodxX8sh4vfxZTlOyWcmmc0k/vyGp6PvFo4RvsFtPoIWeCReyIC8"
Content-Type: application/json; charset=UTF-8
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Content-Length: 17
Server: GSE
{
"items": []
}
as you see items count is 0.
If i make the same request via web interface
https://developers.google.com/drive/v2/reference/files/list it gives me 2 items, as it should be.
This is made with https://developers.google.com/oauthplayground/
GET /drive/v2/files?alt=json&fields=items(id%2Ctitle)%2CnextPageToken&prettyPrint=true&maxResults=2000&q=title%20%3D%20'87BC1CAE-A01C-43A1-BB21-BE3DA6D6C7DC' HTTP/1.1
Host: www.googleapis.com
Content-length: 0
Authorization: OAuth ya29.AHES6ZSDr7bDFMQxjR........ObzyEhkzQmN
HTTP/1.1 200 OK
Content-length: 220
Via: HTTP/1.1 GWA
Content-location: https://www.googleapis.com/drive/v2/files?alt=json&fields=items(id%2Ctitle)%2CnextPageToken&prettyPrint=true&maxResults=2000&q=title%20%3D%20'87BC1CAE-A01C-43A1-BB21-BE3DA6D6C7DC'
X-content-type-options: nosniff
Etag: "Q0cVodxX8sh4vfxZTlOyWcmmc0k/oUg90Ml6_g3EsaXCogiJOEMkZ-M"
X-google-cache-control: remote-fetch
-content-encoding: gzip
Server: GSE
Reason: OK
X-xss-protection: 1; mode=block
Cache-control: private, max-age=0, must-revalidate, no-transform
Date: Tue, 05 Feb 2013 15:30:09 GMT
X-frame-options: SAMEORIGIN
Content-type: application/json; charset=UTF-8
Expires: Tue, 05 Feb 2013 15:30:09 GMT
{
"items": [
{
"id": "0B5XhOf....VlTUTA",
"title": "87BC1CAE-A01C-43A1-BB21-BE3DA6D6C7DC"
},
{
"id": "0B5XhO....EbGRLVVVReGM",
"title": "87BC1CAE-A01C-43A1-BB21-BE3DA6D6C7DC"
}
]
}
Thank you very much, i really appreciate your help
Looks like the confusion is due to the fact that you are using a service account in your code, but comparing the results with what you see in the web interface.
When using the web interface or the OAuth Playground, you are authorizing the app to use your personal account and not a service account. The service account doesn't have access to the same files you have access to, as it is actually an application-owned account.
If you want to use a service account to access your files, you should perform domain-wide delegation as explained at https://developers.google.com/drive/delegation
This still doesn't explain why some queries return results and others don't, but please try everything again without using service accounts and update the issue if things still don't work as expected.