-
-
Notifications
You must be signed in to change notification settings - Fork 2
REST API
GitHub REST API use on the Gallery:
-
Find SHA (id) of main branch at /commit/commit/tree/sha (get the SHA from resulting JSON) https://api.github.com/repos/zoomicon/READCOM_Gallery/branches/main
or get just the SHA (id) of main branch via CURL (since we need to set a custom header):
curl -s -H "Accept: application/vnd.github.VERSION.sha" "https://api.github.com/repos/zoomicon/READCOM_Gallery/commits/main"
-
List Gallery main folders: https://api.github.com/repos/zoomicon/READCOM_Gallery/git/trees/PUT-THE-SHA-HERE?recursive=1 (alternatively get /commit/commit/tree/url from previous JSON)
If you browse this with JSON viewer (e.g. with Firefox) can usually click the "url" value e.g. for child item with "path" value "Gallery" to navigate deeper
Can also use the free REST Debugger from https://www.embarcadero.com/free-tools/rest-debugger (has "Copy Components" button to copy Delphi serialized data for using TRESTClient etc. components to your clipboard)
To get just the latest SHA for main branch using REST Debugger, use:
Request
- Method: GET
- URL: https://api.github.com/repos/zoomicon/READCOM_Gallery/commits/main
Request/Parameters (tab)
Request Parameters: Add
* Kind: Header
* Name: Accept
* Value: application/vnd.github.VERSION.sha
* Do not Encode
Response
- Body (tab)
Can get table of all contents (iterative) with REST Debugger with following settings:
Request
- Method: GET
- JSON Root Element: tree
- URL: https://api.github.com/repos/zoomicon/READCOM_Gallery/git/trees/PUT-THE-SHA-HERE?recursive=1
Response
- Tabular Data (tab)
- Use Types: String