]> git.somenet.org - pub/jan/aic18.git/blob - service-twitter/README.md
fourth attempt for unifiying readmes
[pub/jan/aic18.git] / service-twitter / README.md
1 # Twitter Service
2
3 ## API
4 Provides a REST-API that mainly mirrors the search API from Twitter.
5 The service uses the official Twitter API.
6
7 You can use the search under [http://localhost:8084/search/tweets.json?q=Google](http://localhost:8080/search/tweets.json?q=Google)
8 where `q` is your search string.
9
10 `GET`: `/search/tweets.json?q=` returns tweets matching the given search term as a set of JSON objects  
11 - param: `q` search term
12 example: `/search/tweets.json?q=example`
13
14 `GET`: `/actuator/health` Returns HTTP Status 200 if service is running
15
16 ## API errors
17 `TODO`
18
19 ## external services
20 This twitter service uses the online twitter api.
21 Unfortunately you have to provide your own API Keys, as sharing them is forbidden. In the worst case there would be five people using the same keys at the same time. This probably asks for a ban.
22 I really don't want to risk it, as my application for a [Twitter Developer Platform](https://developer.twitter.com/) account was ridiculously complicated. You have to answer four questions, with at least 400 (?) words, and as detailed as possible. My application apparently wasn't detailed enough, so they asked me follow up questions. After two emails, one with ~1.200 words, they were finally satisfied.
23 Furthermore people with an existing account, like I had, can't create new apps anymore, unless they apply again.
24 So I would advise you to [apply for an account](https://developer.twitter.com/en/apply-for-access) yourself, or maybe ask someone else from the group if they have a spare key.
25
26 The twitter api keys can be set in the file `TODO`. 
27
28 The keys then go into `application.yml` below `oauth:`, i.e. `consumer-key`, `consumer-secret`, `access-token`,
29 `access-token-secret`.
30
31 ## run with docker
32 - `docker image build -t service-twitter .`
33 - `docker container run --env-file=` TODO `-d -p YOUR_PORT:8084 service-twitter:latest`
34
35 ## run local
36 ### requirements
37 `TODO`
38 ### commands
39 `TODO`
40
41 ## examples
42 - API call example: `curl -vs http://localhost:8084/search/tweets.json?q=Google`
43     - Pipe it into e.g. `jq` for a more readable output.
44 - health check test example: `curl -v -X GET http://localhost:8084/actuator/health`