Org audit log api per_page, page issues

when I specify the page and per_page parameters in a URL I continue to get the same results regardless of what page I specify. This happens in postman as well as in a terminal.


which was run with page=1 and per_page=1
(I can only upload one media item as a new user)
so you will have to trust that the image would be the same.
It doesn’t matter if I specify page=3121212
I still get the same result.

They return the exact same result

Here’s a copy paste from the terminal

 curl -u gnosthi  "https://api.github.com/orgs/Openaltar/audit-log?accept=application/vnd.github.v3+json&per_page=1&page=901&include=all"
Enter host password for user 'gnosthi':
[
  {
    "workflow_id": 5124779,
    "head_branch": "master",
    "org": "Openaltar",
    "trigger_id": null,
    "repo": "Openaltar/etherion",
    "created_at": 1629246639594,
    "head_sha": "39ea68d987ed60307394843d1dcb40909e79342b",
    "conclusion": "success",
    "actor": "gnosthi",
    "completed_at": "2021-08-18T00:30:39.000Z",
    "@timestamp": 1629246639594,
    "name": "Check for stale issues and PRs",
    "action": "workflows.completed_workflow_run",
    "started_at": "2021-08-18T00:30:22.000Z",
    "event": "schedule",
    "workflow_run_id": 1141327659,
    "_document_id": "qEkW6wp8FbiMbgVQENOuew"
  }
]

❯ curl -u gnosthi  "https://api.github.com/orgs/Openaltar/audit-log?accept=application/vnd.github.v3+json&per_page=1&page=1&include=all"
Enter host password for user 'gnosthi':
[
  {
    "workflow_id": 5124779,
    "head_branch": "master",
    "org": "Openaltar",
    "trigger_id": null,
    "repo": "Openaltar/etherion",
    "created_at": 1629246639594,
    "head_sha": "39ea68d987ed60307394843d1dcb40909e79342b",
    "conclusion": "success",
    "actor": "gnosthi",
    "completed_at": "2021-08-18T00:30:39.000Z",
    "@timestamp": 1629246639594,
    "name": "Check for stale issues and PRs",
    "action": "workflows.completed_workflow_run",
    "started_at": "2021-08-18T00:30:22.000Z",
    "event": "schedule",
    "workflow_run_id": 1141327659,
    "_document_id": "qEkW6wp8FbiMbgVQENOuew"
  }
]

I’m having the same issue with go code.

func getLogs(g *Github, u string) (*http.Response, error) {
	req, err := http.NewRequest("GET", u, nil)
	if err != nil {
		return nil, err
	}
	ctx, cancel := context.WithTimeout(context.Background(), time.Second * 5)
	defer cancel()
	req.WithContext(ctx)
	req.SetBasicAuth(g.User, g.Token)
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		return resp, err
	}
	return resp, nil
}

// RestGetAllLogs is a method of Github and will return all events from the GitHub audit log
func (g *Github) RestGetAllLogs() (*Events, error) {
	// TODO modify below code to couch offset incrementation in a for loop
	baseUrl := "https://api.github.com/orgs/"+g.Organization+"/audit-log"
	perPage := strconv.Itoa(g.Limit)

	var e Events

	for {
		offset := strconv.Itoa(g.Offset)
		fmt.Printf("getting page %s", offset)
		u := baseUrl + "?" + "accept=application/vnd.github.v3+json&per_page="+perPage+"&page="+offset+"&include=all"
		res, err := getLogs(g, u)
		if err != nil {
			return nil, err
		}
		if res.StatusCode != http.StatusOK {
			return nil, errors.New(fmt.Sprintf("request to %s returned %s",u, res.Status))
		}
		body, err := ioutil.ReadAll(res.Body)
		if err != nil {
			return nil, err
		}
		if len(body) < 2 {
			break
		}
		jErr := json.Unmarshal(body, &e)
		if jErr != nil {
			return nil, jErr
		}
		if err = res.Body.Close(); err != nil {
			return nil, err
		}
		g.Offset = g.Offset + 1
	}

	return &e, nil
}