
  1. [    Home ](/)
2. [Blog](/blog)
3. [New API for Hackdays 2021 open Archive SRF and RTR](/blog?category=671)
4. New API for Hackdays 2021 open Archive SRF and RTR
 
 New API for Hackdays 2021 open Archive SRF and RTR      5 min read  

# New API for Hackdays 2021 open Archive SRF and RTR

  N  Nabil u  November 19, 2024   (Updated October 22, 2026)  

 

 

       [      ](https://x.com/intent/post?url=http%3A//srgdev.digitalapi.ai/blog/new-api-hackdays-2021-open-archive-srf-and-rtr&text=New%20API%20for%20Hackdays%202021%20open%20Archive%20SRF%20and%20RTR "Share on X") [      ](https://www.linkedin.com/sharing/share-offsite/?url=http%3A//srgdev.digitalapi.ai/blog/new-api-hackdays-2021-open-archive-srf-and-rtr "Share on LinkedIn") 

 

 

Image

   ![New API for Hackdays 2021 open Archive SRF and RTR](/sites/default/files/styles/16_9_512x288_focal_point_webp/public/2026-10/blog-693-Blog_6_0.png.webp?itok=j3ZIAwYF) 

 





 

 

  ## On this page

  
  [    Back to top ](#main-content) 

 As SRGSSR, we always try new technologies for providing state-of-the-art experience for both internal and external developers. With the Publication Data Platform (PDP), we collect and correlate publication relevant metadata from various systems like EPG, CMS, archives and online media channels (e.g. Play). We provide access to these vast amount of metadata through our new PDP API as a GraphQL interface. Although the API is in early stage, we want you to try it out as one of the very first and give feedback! For the Hackdays, we have included SRF and RTR archive data with the access point described below. The API will be released on the SRG Developer Portal in the near future.

Feel free to give me feedback on whether you want to see more of this approach to access data from SRGSSR and also on how to improve.

Have fun,

Romain Haenni, Product Owner, <romain.haenni@srgssr.ch>

## Usage

### Basic authentication

Credentials will be revoked soon after the SRG Hackdays:

user: hackdays\_2021

password: PRM2cgg99SbGtQwnZHl0deVET9uwzH

Access with curl

curl --header "Content-Type: application/json" \\

\--user hackdays\_2021:PRM2cgg99SbGtQwnZHl0deVET9uwzH \\

\--request POST \\

\--data '{"query":"{faroItems(first: 3) { edges { title }} }"}' \\

 <https://graphql-api.pdp.dev.srgssr.ch/graphql>

##  

## Example Queries

### Simple Query

{

 faroItems(first: 3) {

 edges {

 title

 }

 }

}

### Query for fetching items

query {

 faroItems(first: 10, after: "MDAwMDM1NjUtMzczMy00ZjY3LTgwOTUtZDExNTZjNmM4OWYw") {

 edges {

 program {

 businessUnit

 mediaType

 showName

 date

 moderators {

 firstName

 lastName

 }

 }

 title

 description

 playLinks

 persons {

 firstName

 lastName

 role

 }

 descriptorPaths

 }

 cursor

 }

}

###  

### Curl Example

curl --header "Content-Type: application/json" \\

\--user hackdays\_2021:PRM2cgg99SbGtQwnZHl0deVET9uwzH \\

\--request POST \\

\--data '{"query":"{faroItems(first: 3) { edges { title } cursor }}"}' \\

 <https://graphql-api.pdp.dev.srgssr.ch/graphql>

result:

{

 "data": {

 "faroItems": {

 "edges": \[

 {

 "title": "EW Ferrera"

 },

 {

 "title": "Gotthard-Basistunnel als Bauwerk der Superlative"

 },

 {

 "title": "Wahl Leuenberger"

 }

 \],

 "cursor": "MDAwMDU0MTYtODdhYy00ZDNmLWE1YTctZTQ4MjJlYzkyOWQ0"

 }

 }

}

###  

### Paginating with Cursors

curl --header "Content-Type: application/json" \\

\--user hackdays\_2021:PRM2cgg99SbGtQwnZHl0deVET9uwzH \\

\--request POST \\

\--data '{"query":"{faroItems(first: 3, after: \\"MDAwMDU0MTYtODdhYy00ZDNmLWE1YTctZTQ4MjJlYzkyOWQ0\\") { edges { title } cursor }}"}' \\

 <https://graphql-api.pdp.dev.srgssr.ch/graphql>

result:

{

 "data": {

 "faroItems": {

 "edges": \[

 {

 "title": "Nationalpark-Serie \\\\\\"Il parc naziunal svizzer\\\\\\" (1)"

 },

 {

 "title": "Puls-mix"

 },

 {

 "title": "Seeland Bank"

 }

 \],

 "cursor": "MDAwMTkwYTctNmM2Ni00MjlmLWI3Y2EtN2NlNDUxNThiOWQ3"

 }

 }

}

##  

## Schema

type FaroItem {

 id: String!

 programId: String!

 itemNr: Int!

 mediaUrns: \[String!\]!

 playLinks: \[String!\]!

 descriptorPaths: \[String!\]!

 program: FaroProgram

 title: String

 producer: String

 description: String

 descriptor: String

 sportDoc: FaroSportDoc!

 persons: \[Person!\]!

}

type FaroItemPage {

 edges: \[FaroItem!\]!

 cursor: String

}

type FaroModerator {

 firstName: String

 lastName: String

}

type FaroProgram {

 id: String!

 businessUnit: String

 mediaType: String

 episodeIds: \[String!\]!

 date: String

 showName: String

 title: String

 seriesNr: Int

 moderators: \[FaroModerator!\]!

}

type FaroSportDoc {

 season: String

 sportEventPaths: \[String!\]!

 sportPaths: \[String!\]!

}

type Person {

 firstName: String

 lastName: String

 aliasFirstName: String

 aliasLastName: String

 role: String

}

type Query {

 faroItems(first: Int!, after: String): FaroItemPage!

}

###  

### Access with PDP python library

pip install srgssr-publication-data-api

**Authentication**

**from** sgqlc.types **import** Variable, non\_null

**from** srgssr\_publication\_data\_api **import** PublicationDataApi

\# replace url, username, password with real values

client **=** PublicationDataApi('[https://graphql-api.pdp.dev.srgssr.ch/graphql'](https://graphql-api.pdp.dev.srgssr.ch/graphql%27), hackdays\_2021', 'PRM2cgg99SbGtQwnZHl0deVET9uwzH')

op **=** client.query\_op()

\# to restrict fields to just title and cursor (for pagination):

selector **=** op.faro\_items(first**=**5)

selector.edges().title()

selector.cursor()

\# if you just want to see the schema, just remove the selector.

result **=** client.run\_query(op)

print(result)

Set the user environment variables:

export PDP\_API=<https://graphql-api.pdp.dev.srgssr.ch/graphql>

export USER\_NAME=hackdays\_2021

export USER\_PASSWORD=PRM2cgg99SbGtQwnZHl0deVET9uwzH

Then you can query the data like in the following code sample:

**Sample Usage**

\# Needed imports

from sgqlc.types import Variable, non\_null

from sgqlc.operation import Operation

from srgssr\_publication\_data\_api import client, pdp\_schema as schema

op = Operation(schema.Query, name='faroItems', variables={'first':non\_null(int), 'after':str})

\# to restrict fields to just title and cursor (for pagination):

selector = op.faro\_items(first=Variable('first'), after=Variable('after'))

selector.edges.title()

selector.cursor()

\# if you just want to see the schema, just remove the selector.

print(client.run\_query(op, {'first': 100})\['data'\])

Or check the following jupyter example: ...



 

 

 

 ### Tags

 

 

  N  

 Written by### Nabil 