Skip to contents

Parse a RIS OGD REST API search response into a tidy tibble. The parser works with either an httr2_response object or an already decoded response list.

Usage

ris_parse_search(x, requested_page = NULL, requested_per_page = NULL)

Arguments

x

An httr2_response or a decoded list.

requested_page

Optional requested page number for metadata fallback.

requested_per_page

Optional requested page size for metadata fallback.

Value

A tibble parsed from one RIS response payload. Includes list-columns content_urls and app_metadata. The decision_date column, when present, is parsed to Date.

Examples

payload <- list(
  OgdSearchResult = list(
    status = "ok",
    OgdDocumentResults = list(
      OgdDocumentReference = list(
        list(
          Data = list(
            Metadaten = list(
              Technisch = list(ID = "DOC-1", Applikation = "Vwgh"),
              Allgemein = list(DokumentUrl = "https://example.org/meta/1")
            ),
            Dokumentliste = list(
              ContentReference = list(
                list(
                  Urls = list(
                    ContentUrl = list(
                      list(DataType = "Html", Url = "https://example.org/doc/1.html")
                    )
                  )
                )
              )
            )
          )
        )
      )
    )
  )
)
ris_parse_search(payload)
#> # A tibble: 1 × 5
#>   id    application document_url               content_urls app_metadata    
#>   <chr> <chr>       <chr>                      <list>       <list>          
#> 1 DOC-1 Vwgh        https://example.org/meta/1 <chr [1]>    <named list [3]>