irrdnet/irrd

Please consider to serialize the content returned by /v1/status as a JSON if users request it

Closed this issue · 2 comments

Is your feature request related to a problem? Please describe.
For those that want to interact with IRRd programmatically, parsing the content returned by /v1/status/ is complex and adds extra code lines.

Describe the solution you'd like
I suggest to serialize the content returned by /v1/status/ as a JSON object if the HTTP request includes the Accept: application/json header or if the URL is /v1/status/json/

Describe alternatives you've considered
Parsing the current human readable text returned by /v1/status/ with textfsm

Additional context
N/A

Are you aware of the !J whois query? Example here: https://irrd.as213279.net/v1/whois/?q=!J-*
And the GraphQL DatabaseStatus query, e.g.:

query {
  databaseStatus {
    source
    source_type
    authoritative
    objectClassFilter
    rpkiRovFilter
    scopefilterEnabled
    routePreference
    localJournalKept
    serialOldestJournal
    serialNewestJournal
    serialLastExport
    serialNewestMirror
    nrtm4ClientSessionId
    nrtm4ClientVersion
    nrtm4ServerSessionId
    nrtm4ServerVersion
    nrtm4ServerLastUpdateNotificationFileUpdate
    nrtm4ServerLastSnapshotVersion
    lastUpdate
    synchronisedSerials
    aliased_sources
  }
}

I wasn't aware you could query status with GraphQL. It's perfect. Thanks