As test data, we will use the content of the README for each repository in our graph, and see what kind of information can be extracted from it.
The API to get the README from a repository is the following:
GET /repos/<owner>/<repo>/readme
Similarly to what we have done in the previous chapter, we are going to use apoc.load.jsonParams to load this data into Neo4j. First, we set our GitHub access token, if any (optional):
:params {"token": "8de08ffe137afb214b86af9bcac96d2a59d55d56"}
Then we can run the following query to retrieve the README of all repositories in our graph:
MATCH (u:User)-[:OWNS]->(r:Repository)
CALL apoc.load.jsonParams("https://api.github.com/repos/" + u.login + "/" + r.name + "/readme", {Authorization: "Token " + $token}, null, null, {failOnError: false}) YIELD value
CREATE (d:Document {name: value.name, content:value.content, encoding: value.encoding})
CREATE...