home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

6 rows where "created_at" is on date 2022-10-30, issue = 1427293909 and user = 9599 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: updated_at (date)

user 1

  • simonw · 6 ✖

issue 1

  • API explorer tool · 6 ✖

author_association 1

  • OWNER 6
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1296339386 https://github.com/simonw/datasette/issues/1871#issuecomment-1296339386 https://api.github.com/repos/simonw/datasette/issues/1871 IC_kwDOBm6k_c5NRJG6 simonw 9599 2022-10-30T20:03:04Z 2022-10-30T20:03:04Z OWNER

I do need to skip CSRF for these API calls. I'm going to start out by doing that using the skip_csrf() hook to skip CSRF checks on anything with a content-type: application/json request header.

python @hookimpl def skip_csrf(scope): if scope["type"] == "http": headers = scope.get("headers") if dict(headers).get(b'content-type') == b'application/json': return True

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
API explorer tool 1427293909  
1296339205 https://github.com/simonw/datasette/issues/1871#issuecomment-1296339205 https://api.github.com/repos/simonw/datasette/issues/1871 IC_kwDOBm6k_c5NRJEF simonw 9599 2022-10-30T20:02:05Z 2022-10-30T20:02:05Z OWNER

Realized the API explorer doesn't need the API key piece at all - it can work with standard cookie-based auth.

This also reflects how most plugins are likely to use this API, where they'll be adding JavaScript that uses fetch() to call the write API directly.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
API explorer tool 1427293909  
1296131872 https://github.com/simonw/datasette/issues/1871#issuecomment-1296131872 https://api.github.com/repos/simonw/datasette/issues/1871 IC_kwDOBm6k_c5NQWcg simonw 9599 2022-10-30T06:27:56Z 2022-10-30T06:27:56Z OWNER

Initial prototype API explorer is now live at https://latest-1-0-dev.datasette.io/-/api

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
API explorer tool 1427293909  
1296130073 https://github.com/simonw/datasette/issues/1871#issuecomment-1296130073 https://api.github.com/repos/simonw/datasette/issues/1871 IC_kwDOBm6k_c5NQWAZ simonw 9599 2022-10-30T06:20:56Z 2022-10-30T06:20:56Z OWNER

That initial prototype looks like this:

It currently shows the returned JSON from the API in an alert(). Next I should make that part of the page instead.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
API explorer tool 1427293909  
1296126389 https://github.com/simonw/datasette/issues/1871#issuecomment-1296126389 https://api.github.com/repos/simonw/datasette/issues/1871 IC_kwDOBm6k_c5NQVG1 simonw 9599 2022-10-30T06:04:48Z 2022-10-30T06:04:48Z OWNER

This is even more important now I have pushed: - #1866

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
API explorer tool 1427293909  
1296114136 https://github.com/simonw/datasette/issues/1871#issuecomment-1296114136 https://api.github.com/repos/simonw/datasette/issues/1871 IC_kwDOBm6k_c5NQSHY simonw 9599 2022-10-30T05:15:40Z 2022-10-30T05:15:40Z OWNER

Host it at /-/api

It's an input box with a path in and a textarea you can put JSON in, plus a submit button to post the request.

It lists the API endpoints you can use - click on a link to populate the form field plus a example.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
API explorer tool 1427293909  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 1310.624ms · About: github-to-sqlite