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
|
Example Queries
Simple Query
|
Query for fetching items
|
Curl Example
|
Paginating with Cursors
|
Schema
|
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'
, 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:
|
Then you can query the data like in the following code sample:
Sample Usage
|
Or check the following jupyter example: ...