# Github API

## 개인 토큰 발급 받는 곳

* <https://github.com/settings/tokens>

## 이슈 생성 하는 법

* url 생성
  * <https://github.com/api/v3/repos/{organization}/{project}/issues>
  * ex) <https://github.com/api/v3/repos/tidyline/til/issues>

1\) `curl`로 이슈 생성하기

```
curl -X POST -i -u {id}:{token} -d \
'{"title" : "제목이요!", "body" : "내용이요!"}'
https://github.com/api/v3/repos/{organization}/{project}/issues
```

2\) `node` https 모듈을 이용해서 이슈 생성하기

```javascript
const https = require('https');
const issue = {
    title : '제목이요!',
    body : '내용이요'
};

const req = https.request({
  host: 'github.com',
  method: 'POST',
  port: 443,
  path: '/api/v3/repos/{organization}/{project}/issues',
  headers: {
    'Accept': 'application/vnd.github.symmetra-preview+json',
    'Authorization': 'token {token}'
  }
}, res => {
  let data = '';
  res.on('data', chunk => data += chunk);
  res.on('end', () => console.log(JSON.parse(data)));
});

req.write(JSON.stringify(issue));
req.on('error', e => console.log('error', e));
req.end();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tidyline.gitbook.io/today-i-learned/etc/github-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
