Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: The requested resource does not exist #213

Closed
Boscop opened this issue Nov 18, 2018 · 10 comments
Closed

Docs: The requested resource does not exist #213

Boscop opened this issue Nov 18, 2018 · 10 comments
Assignees

Comments

@Boscop
Copy link

Boscop commented Nov 18, 2018

I want to use this crate to append rows to a google sheet, but where can I find the docs?
Here it says "The requested resource does not exist":
https://docs.rs/google-sheets4/1.0.8+20181010/google_sheets4/

@Boscop
Copy link
Author

Boscop commented Nov 18, 2018

Also, these docs are also 404:
http://byron.github.io/google-apis-rs/google_sheets4_cli/sheets/api/samples/writing#append_values
http://byron.github.io/google-apis-rs/google_sheets4_cli/sheets/api/guides/values#appending_values
which are linked to from this page:
http://byron.github.io/google-apis-rs/google_sheets4_cli/spreadsheets_values-append/

Btw, I installed the google-sheets4-cli but when I invoke it, and open the link that it shows in my browser, I get:

401. That’s an error.

Error: deleted_client

The OAuth client was deleted.

EDIT: I got it working with a custom credentials.json file, but it uses the whole drive scope by default. I only want to use the spreadsheets scope, so I revoked the drive scope and tried this but it failed:

$ sheets4 --scope https://www.googleapis.com/auth/spreadsheets spreadsheets values-get <my-spreadsheet-id> A1:D3
USAGE:
    sheets4 [FLAGS] [OPTIONS] [SUBCOMMAND]

Please specify the main sub-command.

It seems to be parsing the arguments wrongly?
I did it as described here:
http://byron.github.io/google-apis-rs/google_sheets4_cli/spreadsheets_batch-update/#scopes

Btw, what's the right format to pass the values that it should append?
This doesn't work:

$ sheets4 spreadsheets values-append <my-spreadsheet-id> A1:B2 -r values=[[1,2],[3,4]]
Field -> Field 'values' does not exist.

$ sheets4 spreadsheets values-append <my-spreadsheet-id> A1:B2 -r . values=[[1,2],[3,4]]
Field -> Field 'values' does not exist.

@Boscop
Copy link
Author

Boscop commented Nov 18, 2018

I want to do it manually from Rust code now, so I need to construct it like here:

let mut request: api::ValueRange = json::value::from_value(object).unwrap();
let mut call = self.hub.spreadsheets().values_append(request, opt.value_of("spreadsheet-id").unwrap_or(""), opt.value_of("range").unwrap_or(""));

but where is ValueRange defined?
It doesn't show up here:
https://github.com/Byron/google-apis-rs/search?q=ValueRange&unscoped_q=ValueRange

Do I have to generate the Rust API code myself?

@Boscop
Copy link
Author

Boscop commented Nov 18, 2018

Hm, when I try it now, my request to append values to my spreadsheet fails with:

Token retrieval failed with error: Invalid Scope: 'no description provided'

Any idea why?


EDIT: When I do .add_scope("https://www.googleapis.com/auth/spreadsheets") it works now, but for every invocation of my tool I have to enter a code in the browser. It prints:

Please enter <CODE> at https://www.google.com/device and grant access to this application
Do not close this application until you either denied or granted access.
You have time until 2018-11-18 12:23:08.273506646 +01:00.

How can I make it so that I don't have to enter a new code in my browser on every invocation of my tool?

(Btw, my test tool is just a modification of this example combined with cmn.rs to load the secret from the json file.)

@Boscop
Copy link
Author

Boscop commented Nov 18, 2018

Ah, I figured it out, I had to use DiskTokenStorage -.-

But this issue remains: How to pass the spreadsheets scope to the CLI?

@IslandUsurper
Copy link
Contributor

Let's get back to the original issue: docs fail to build.

It looks like the Color struct in sheets4 has examples in different languages, but rustdoc interprets them as Rust code. Possibly because they are indented. As an experiment, removing the indention lets docs get built, but the examples look ugly. Instead, surrounding the examples in their lang-specific markdown, ````java` for example, avoids the issue, and looks better.

Unfortunately, I'm not sure how to make that change through Mako. Are the docs coming directly from Google? Is there a way to make one-off changes like this through the build process?

IslandUsurper added a commit to IslandUsurper/google-apis-rs that referenced this issue Dec 7, 2018
Rustdoc assumes indented code is Rust code, but when it isn't, the docs
fail to build. The Sheets API has Java, Objective-C, and JavaScript
examples in its descripiton. Wrap these examples in language-tagged
triple-backticks to prevent rustdoc from trying to compile them.

Fixes Byron#213.
@IslandUsurper
Copy link
Contributor

So, I found the JSON files describing the API. I just wonder how often those get regenerated, and how to keep my change merged in.

Byron pushed a commit that referenced this issue Dec 21, 2018
Rustdoc assumes indented code is Rust code, but when it isn't, the docs
fail to build. The Sheets API has Java, Objective-C, and JavaScript
examples in its descripiton. Wrap these examples in language-tagged
triple-backticks to prevent rustdoc from trying to compile them.

Fixes #213.
@Byron
Copy link
Owner

Byron commented Dec 22, 2018

Ah, I figured it out, I had to use DiskTokenStorage -.-

But this issue remains: How to pass the spreadsheets scope to the CLI?

First of all, sorry for the late reply and thanks for all the research you have poured into this issue thus far!

Assuming that you have the official CLI (e.g. by running cargo install google-sheets4-cli) already available, you can set the desired/required scope using the --scope flag. Based on this, it will try to find a suitable token on disk, or request it via user interaction. If you are trying to write an own CLI, it would have to mimic this kind of logic I presume.

@Byron
Copy link
Owner

Byron commented Dec 22, 2018

So, I found the JSON files describing the API. I just wonder how often those get regenerated, and how to keep my change merged in.

Right now there is no way to keep it in, but I think the system could be adjusted to look for patch files, and reapply these automatically after updating the corresponding JSON API descriptor.

@Goncalerta
Copy link

I'd like to point out that, although this issue is closed, the docs are still not compiling.

The fix on #214 was reverted on 86a884c.

However, the fix was never published on crates.io, being the last version published at Oct 14, 2018 and #214 was merged at Dec 21, 2018.

@Byron Byron reopened this Jul 5, 2019
@Byron Byron self-assigned this Jul 5, 2019
@ghost ghost closed this as completed in f33fae4 Jul 5, 2019
@Byron
Copy link
Owner

Byron commented Jul 5, 2019

The sheets documentation is now available at https://docs.rs/google-sheets4/1.0.10+20190625/google_sheets4 .

Three additional APIs failed, but have been fixed (permanently) as well: chat1, vision1, spanner1.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants