]> git.somenet.org - pub/jan/aic18.git/blob - service-twitter/README.md
GITOLITE.txt
[pub/jan/aic18.git] / service-twitter / README.md
1 # Twitter Service
2
3
4 ## API
5 Provides a REST-API that mainly mirrors the search API from Twitter.
6 The service uses the official Twitter API.
7
8 You can use the search under [http://localhost:8084/search/tweets.json?q=Google](http://localhost:8080/search/tweets.json?q=Google)
9 where `q` is your search string.
10
11 `GET`: `/search/tweets.json?q=` returns tweets matching the given search term as a set of JSON objects  
12 - param: `q` search term
13 example: `/search/tweets.json?q=example`
14
15 `GET`: `/actuator/health` Returns HTTP Status 200 if service is running
16
17
18 ## external services
19 This twitter service uses the online twitter api.
20 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.
21 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.
22 Furthermore people with an existing account, like I had, can't create new apps anymore, unless they apply again.
23 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.
24 The twitter api keys can be set in the file `twitter.env`. 
25
26
27 ## run with docker
28 - `docker image build -t service-twitter .`
29 - `docker container run --env-file=twitter.env -d -p YOUR_PORT:8084 service-twitter:latest`
30
31
32 ## run local
33
34 ### requirements
35 - JDK 11
36
37 ### commands
38 - `./mvnw spring-boot:run`
39
40 ## examples
41 - API call example: `curl -vs http://localhost:8084/search/tweets.json?q=Google`
42     - Pipe it into e.g. `jq` for a more readable output.
43 - health check test example: `curl -v -X GET http://localhost:8084/actuator/health`