ChatGPT Access to GitHub Repositories — Part 3

David Such
12 min readDec 28, 2023

In order to access private repositories we need to delve into the black art of authentication and authorization. Our focus will be on authenticating RESTful APIs, as that is what GitHub uses.

Figure 1. A RESTful GET Request [Image Credit: DALL-E]

RESTful API Message Contents

When making a request to a RESTful API, several components are involved (Figure 2). These include:

An Endpoint URL (Uniform Resource Locator): This is the address of the resource on the server you’re requesting. For example, https://api.example.com/users.

Headers: These provide additional information about the request. Common headers include:

  • Content-Type: Indicates the media type of the request, like application/json.
  • Authorization: Contains credentials for authentication.
  • Accept: Specifies the media type the client can process.
  • User-Agent: Identifies the client software.

Payload (Body): This is the data sent with the request. In a GET request, there is no payload; in POST, PUT, or PATCH requests, this contains the data you’re sending to the server.

Method: The HTTP method (e.g., GET, POST, PUT, DELETE) indicating the desired action.

--

--

David Such

Reefwing Software · Embedded Systems Engineer · iOS & AI Development · Robotics · Drones · Arduino · Raspberry Pi · Flight Control