Search code examples
github-apigist

Explain the parameters in GitHub Gist raw_url attribute


I am working with the GitHub GIST API. I came across raw_url attribute which is given for each file in a gist. I wanted to what all the parameters in the URL mean.

Example raw_url: https://gist.githubusercontent.com/algomaster99/d75743336c68306f242ea7ec846f55e9/raw/243230d8f9f80320d839db1f944ac7918ffdaa68/.block

  1. https://gist.githubusercontent.com/ - Domain from where the file content is fetched.
  2. algomaster99 - User ID
  3. d75743336c68306f242ea7ec846f55e9 - GIST ID
  4. 243230d8f9f80320d839db1f944ac7918ffdaa68 - I don't know what is this for exactly.
  5. .block - This is an optional parameter in URL. Works without it too.

Can anyone please elaborate on points 4 and 5?


Solution

  • Component 4 (243230d8f9f80320d839db1f944ac7918ffdaa68) is the revision id, a gist can have multiple revisions so you need the id to point out which revision you want to fetch.

    Component 5 (.block) is simply the name of the file in the gist that you want to fetch. I'm not sure why the .block file is retrieved even if you omit it from the path, it could be that the first file is returned when no name is given.