MyOwnClone / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
1 stars 0 forks source link

Malformed HTTP request for Orgunits: get requests #401

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. New VS project using v1.5 directory_v1 and Authentication libraries from 
NuGet.
2. Standard DirectoryService implementation, using service account (see 
attached DirectoryService.cs).  This is known working and will retrieve 
OrgUnits using List.
3. The following:

    var service = BuildDirectoryService();
    var orgUnitPath = new Repeatable<String>(new string[] { "/Sitel 3" });
    var orgUnit = service.Orgunits.Get(CUSTOMER_ID, orgUnitPath).Execute();
    Console.WriteLine(orgUnit.Name);

What is the expected output? What do you see instead?

I expected to see the organization unit's name.

I see a 
'GoogleApiException: An Error occurred, but the error response could not be 
deserialized.' 
with an inner exception:
JsonReaderException: {"Error parsing NaN value. Path '', line 0, position 0."}

Fiddler shows me the response is: 'HTTP/1.1 404 Not Found' and the request 
header looks odd:

GET /admin/directory/v1/customer/MY-CUST-ID/orgunits%7B/orgUnitPath*%7D HTTP/1.1

Apart from the braces being converted to %7B and %7d, it looks like the 
specification on 
https://developers.google.com/admin-sdk/directory/v1/reference/orgunits/get 
which is:

GET 
https://www.googleapis.com/admin/directory/v1/customer/{customerId}/orgunits{/or
gUnitPath*}

It looks like the customerID is being substituted correctly but the 
/orgUnitPath* is not.

What version of the product are you using? v1.5
What is your operating system? Windows 7 SP1, patched recently.
What is your IDE? Visual Studio 2012 Premium Update 3
What is the .NET framework version? 4.5 with patches.

Please provide any additional information below.

Others are seeing this issue: 
http://stackoverflow.com/questions/18957154/google-directory-api-org-unit-error-
404

Original issue reported on code.google.com by simon.ga...@gmail.com on 15 Oct 2013 at 9:35

Attachments:

GoogleCodeExporter commented 9 years ago
The same behaviour is seen when trying to perform a delete: the request header 
is

DELETE /admin/directory/v1/customer/MY-CUST-ID/orgunits%7B/orgUnitPath*%7D 
HTTP/1.1

Original comment by simon.ga...@gmail.com on 15 Oct 2013 at 12:53

GoogleCodeExporter commented 9 years ago
Likewise for patch:

PATCH /admin/directory/v1/customer/MY-CUST-ID/orgunits%7B/orgUnitPath*%7D 
HTTP/1.1

and update:

PUT /admin/directory/v1/customer/MY-CUST-ID/orgunits%7B/orgUnitPath*%7D HTTP/1.1

Original comment by simon.ga...@gmail.com on 15 Oct 2013 at 1:46

GoogleCodeExporter commented 9 years ago
I've created a new program which demonstrates the problem.  To implement, add 
it to a new solution and in Package Manager Console, run:

Install-Package Google.Apis.Authentication -Pre
Install-Package Google.Apis.Admin.Directory.directory_v1 -Pre

I run my code with a service account as it has to run unattended but I've made 
this code work with service accounts or client IDs.  If you want to run with a 
Client ID, fill in these constants:

CLIENT_ID
CLIENT_SECRET

and in the first line of Main, set:

bool useServiceAccount = false;

If you want to run with a service account, set these constants:

CUSTOMER_ID
SERVICE_ACCOUNT_USER  (the primary email of an admin account)
SERVICE_ACCOUNT_EMAIL
SERVICE_ACCOUNT_PKCS12_FILE_PATH

and set the first line of Main to 

bool useServiceAccount = true;

Original comment by simon.ga...@gmail.com on 20 Oct 2013 at 12:49

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 23 Oct 2013 at 1:08

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 29 Oct 2013 at 2:07

GoogleCodeExporter commented 9 years ago
https://codereview.appspot.com/36390044/

Original comment by pele...@google.com on 8 Dec 2013 at 10:35

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 8 Dec 2013 at 10:39

GoogleCodeExporter commented 9 years ago
Next release (planned to be in the beginning of January, hope even earlier...) 
will contain this fix.

Original comment by pele...@google.com on 9 Dec 2013 at 3:15

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 9 Dec 2013 at 3:16

GoogleCodeExporter commented 9 years ago
Joe worked on the spec on python
  https://github.com/uri-templates/uritemplate-py

URL paths follow this RFC: http://tools.ietf.org/html/rfc6570

Original comment by pele...@google.com on 10 Dec 2013 at 7:26

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 13 Dec 2013 at 11:46

GoogleCodeExporter commented 9 years ago
This is still an issue with the current version.

Original comment by AntariMy...@gmail.com on 21 Mar 2015 at 8:08