SHOOGLE(1)

πŸ“¦ version 0.1.4, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– SHOOGLE(1) πŸ’–

okay bestie, sit DOWN, because today we're talking about shoogle β€” it's a command-line glow-up that gives you access to the Google API, and it's genuinely iconic. πŸ¦‹

✨ NAME ✨

shoogle β€” command-line access to the Google API πŸ’…


🌸 SYNOPSIS 🌸

shoogle -h

shoogle show [--debug-request-level <n>] [--debug-response-level <n>]
[<API-PATH>]

shoogle execute [-c <CLIENT-SECRET-FILE>] [--credentials-file CREDENTIALS-FILE | --credentials-profile CREDENTIALS-PROFILE>] [-f <path>]
<API-PATH> <JSON-FILE>

πŸ‘‘ DESCRIPTION πŸ‘‘

so shoogle is a CLI tool that hands you the keys to Google API functions, no cap. you can use it to discover interfaces and methods, and also to execute them. it's giving "look at the menu, then order the thing." πŸ“

πŸŽ€ Parameters πŸŽ€

  • -h, –help β€” prints the command-line help info. your little cheat sheet, bestie. 🫢
  • show β€” lists info about Google API Services, Resources, and methods. the window-shopping of it all. πŸ›οΈ
  • execute β€” actually runs a Google API method. main character energy only. πŸ”₯
  • JSON-FILE β€” a JSON-formatted file holding your API request info. peek the JSON-FILE section for the deets. ✨
  • API_PATH β€” the path spec for a Google API method. peep the API-PATH section for details. πŸ’œ

πŸ’… `Show' Command Options πŸ’…

  • –debug-request-level <n> β€” a non-negative integer that sets the recursion level for info output on the method request documentation. 🧚
  • –debug-response-level <n> β€” a non-negative integer that sets the recursion level for info output on the method response documentation. 🌈

πŸ”₯ `Execute' Command Options πŸ”₯

  • -c <CLIENT-SECRET-FILE>, –client-secret-file <CLIENT-SECRET-FILE> β€” a path to the client secret JSON file, used to kick off OAuth2 authentication. check the CLIENT-SECRET-FILE section for details. πŸ”‘
  • -f <path>, –media-file <path> β€” the file to use for media-related operations. πŸ“
  • –credentials-file <CREDENTIALS-FILE> β€” pick a specific set of already-established OAuth2 credentials. see CREDENTIALS-FILE for details. 🎟️
  • –credentials-profile <CREDENTIALS-PROFILE> β€” pick a profile for the OAuth2 credentials. see CREDENTIALS-PROFILE for details. πŸ‘€

πŸ¦‹ JSON-FILE πŸ¦‹

the shoogle show command can show you the request info you need for an API method β€” and this file holds the required input parameters for a method to be executed, in that exact format. it's giving "copy the homework but change it a lil." πŸ“

a value of - means the JSON info gets read from STDIN. yes, that dash is doing heavy lifting. πŸ’€

πŸ’œ API-PATH πŸ’œ

the "API Path" for an API method looks like "SERVICE:VERSION.RESOURCE.METHOD". periodt. πŸ’…

for the show command, this parameter is optional, and it can be truncated. like β€” if you leave it out entirely, you get a list of Services. if you drop the method name off the end, you get a list of methods. and for a full path, you get the detail on the method's inputs and outputs. πŸ”

for the execute command, this is what defines the method that gets called. no truncation shenanigans there, bestie. 🚨

🧚 CLIENT-SECRET-FILE 🧚

the Client Secret JSON file holds user info for authorization. you can download it from the Google Console OAuth 2.0 Client ID page. the client IDs are listed on the Credentials page (https://console.cloud.google.com/apis/credentials). go get 'em. 🫑

🎟️ CREDENTIALS-FILE 🎟️

the CREDENTIALS-FILE holds the authorization tokens generated from a successful OAuth 2.0 executed transaction. it lets authentication just... succeed on later calls with zero user interaction. iconic, honestly. ✨

by default, this file lives in ~/.shoogle/credentials/<profile>/. this option overrides that path. 🏠

typically? you don't need this option. lowkey it's just there if you want it. πŸ™ˆ

πŸ‘€ CREDENTIALS-PROFILE πŸ‘€

shoogle aggregates CREDENTIALS-FILEs by profile, and this option lets you name the profile. the default is "default". πŸ’–

typically, you don't need this one either. it's optional, bestie. πŸŽ€


🌟 EXAMPLES 🌟

list services:

shoogle show

list resources for a service:

shoogle show urlshortener:v1.

list methods for a resource:

shoogle show urlshortener:v1.url

list parameters and results for a method:

shoogle show urlshortener:v1.url.list

call a method:

echo '{}' | shoogle execute -c <secrets.json> urlshortener:v1.url.list -

okay so jq is a command-line JSON builder/parser, and this next example is the ✨slay✨ one β€” it shows how to upload a video from a JSON template and pull the ID out of the response:

$ cat upload-video.template.json
{
  "part": "snippet",
  "body": {
    "snippet": {
      "title": $title,
      "description": $description
    }
  }
}

$ jq -n -f upload-video.template.json --arg title "Chess" --arg description "Norway Chess" |
    shoogle execute -c your_client_id.json youtube:v3.videos.insert - -f chess.mp4 |
    jq -r '.id'
wUArz2nPGqA

ate. no crumbs. πŸ”₯


🫢 SEE ALSO 🫢


and that's the whole page, bestie β€” this one dropped back in Nov 2017 as part of the shoogle manual, so go forth and query some APIs responsibly. mwah. πŸ’‹

πŸ“¦ where this page comes from