Used APIs - SWE-574-Spring-2018/LinkyWay GitHub Wiki
Twitter API
Twitter API is used in project for for two main purposes:
- 1) User Profile: User login to system via Twitter account. In order to create or verify profile, TwitterID is requested from Twitter API
- 2) TweetNode Entitiy: Users can relate a tweet with a node via TweetIDs. Content of the tweets is shown in UI through Twitter API.
WikiData API
WikiData API is used to identify the elements in the system structure. Nodes can be separated from each other with their WikiData contents which are provided by WikiData API. Relations between Nodes are also represented with WikiData properties.
Elucidate Server
Elucidate Server is a Web Annotation Protocol compliant which is used as annotation API by the LinkyWay.
Disclaimer: The annotation server used in following examples have been used for testing and templating purposes. The annotation server and relevant links may not be available at a later time.
Creating Annotation Container
Each annotation must be contained in an annotation container which must be publicly accessible and resposible from only containing annotations. The following example POST request will create an annotation container within the annotation server. The request will return a JSON-LD which includes container's id.
curl -X POST -H 'Content-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"' -d '{ "@context": [ "http://www.w3.org/ns/anno.jsonld", "http://www.w3.org/ns/ldp.jsonld" ], "type": [ "BasicContainer", "AnnotationCollection" ], "label": "A Container for Web Annotations" }' 'http://124ee39b.ngrok.io/annotation/w3c/'
Retrieving Container's Annotations
http://124ee39b.ngrok.io/annotation/w3c/95fcfc10-fdb4-4125-b0f0-2565a7bb4df5/ is the address of the annotation container created for LinkyWay usage. The container Id is "95fcfc10-fdb4-4125-b0f0-2565a7bb4df5". The following example GET request will return a JSON-LD which contains annotations contained by the container:
curl -X GET 'http://124ee39b.ngrok.io/annotation/w3c/95fcfc10-fdb4-4125-b0f0-2565a7bb4df5/'
Annotation Creation
To create Annotation following example POST requests can be used:
-
curl -X POST -H 'Content-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"' -d '{ "type":"Annotation", "body":{ "type":"TextualBody", "value":"The first software engineer whose code ran on the moon." }, "@context":"http://www.w3.org/ns/anno.jsonld", "target":{ "selector":{ "prefix":"", "exact":"Margaret Hamilton", "type":"TextQuoteSelector", "suffix":"'s keynote at #ICSE2018. She was an integral part of NASA's Apollo mission." }, "source":"https://twitter.com/xennygrimmato_/status/1003494674365968389" } }' 'http://124ee39b.ngrok.io/annotation/w3c/95fcfc10-fdb4-4125-b0f0-2565a7bb4df5/'
-
curl -X POST -H 'Content-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"' -d '{ "type":"Annotation", "body":{ "type":"TextualBody", "value":"https://www.wikidata.org/wiki/Q46611" }, "@context":"http://www.w3.org/ns/anno.jsonld", "target":{ "selector":{ "prefix":"Margaret Hamilton's keynote at #ICSE2018. She was an integral part of NASA's ", "exact":"Apollo mission", "type":"TextQuoteSelector", "suffix":"." }, "source":"https://twitter.com/xennygrimmato_/status/1003494674365968389" } }' 'http://124ee39b.ngrok.io/annotation/w3c/95fcfc10-fdb4-4125-b0f0-2565a7bb4df5/'
Retrieving Annotations by Source
The following example GET request will return a JSON-LD which contains annotations linked to the annotated source:
curl -X GET '[http://124ee39b.ngrok.io/annotation/w3c/services/search/body?value={source}&fields=source&strict=false](http://124ee39b.ngrok.io/annotation/w3c/services/search/body?value=h&fields=source&strict=false)'