<commit_before># API

## Get data
Request:
```
GET /api/data HTTP/1.1
Host: www.denkmal.org
```

Response:
```json
{
   "venues":[
      {
         "id":78,
         "name":"<NAME>",
         "url":"http:\/\/www.example.com",
         "address":"Address 1",
         "latitude":12.1,
         "longitude":13.3
      },
      {
         "id":79,
         "name":"<NAME>"
      }
   ],
   "events":[
      {
         "id":934,
         "venue":123,
         "description":"Foo",
         "title":"Bar",
         "from":1371386731,
         "until":1371386731,
         "starred":false,
         "song":{
            "label":"Song 1",
            "url":"http:\/\/denkmal.test\/userfiles\/songs\/64.mp3"
         }
      },
      {
         "id":935,
         "venue":123,
         "description":"Foo",
         "from":1371386731,
         "starred":false
      }
   ],
   "messages":[
      {
         "id":401,
         "venue":78,
         "created":1371386731,
         "text":"Foo 1"
      },
      {
         "id":402,
         "venue":78,
         "created":1371386731,
         "text":"Foo 2"
      }
   ],
   "dayOffset" : 6
}
```


## Get messages
Request:
```
GET /api/messages HTTP/1.1
Host: www.denkmal.org
```

Response:
```json
[
   {
      "id":4,
      "venue":2,
      "created":1371383458,
      "text":"Foo 1"
   },
   {
      "id":5,
      "venue":3,
      "created":1371383458,
      "text":"Foo 2"
   }
]
```


## Send message
Request:
```
POST /api/message HTTP/1.1
Host: www.denkmal.org
content-type: text/plain
content-length: 65

venue=1&text=foobar&hash=<HASH>
```
Response:
```json
{
	"id":13,
	"venue":1,
	"created":1380379451,<commit_msg>Add docu<commit_after># API

## Get data
Request:
```
GET /api/data HTTP/1.1
Host: www.denkmal.org
```

Response:
```json
{
   "venues":[
      {
         "id":78,
         "name":"<NAME>",
         "url":"http:\/\/www.example.com",
         "address":"Address 1",
         "latitude":12.1,
         "longitude":13.3
      },
      {
         "id":79,
         "name":"<NAME>"
      }
   ],
   "events":[
      {
         "id":934,
         "venue":123,
         "description":"Foo",
         "title":"Bar",
         "from":1371386731,
         "until":1371386731,
         "starred":false,
         "song":{
            "label":"Song 1",
            "url":"http:\/\/denkmal.test\/userfiles\/songs\/64.mp3"
         }
      },
      {
         "id":935,
         "venue":123,
         "description":"Foo",
         "from":1371386731,
         "starred":false
      }
   ],
   "messages":[
      {
         "id":401,
         "venue":78,
         "created":1371386731,
         "text":"Foo 1"
      },
      {
         "id":402,
         "venue":78,
         "created":1371386731,
         "text":"Foo 2"
      }
   ],
   "dayOffset" : 6
}
```


## Get messages
Request:
```
GET /api/messages HTTP/1.1
Host: www.denkmal.org
```

Response:
```json
[
   {
      "id":4,
      "venue":2,
      "created":1371383458,
      "text":"Foo 1"
   },
   {
      "id":5,
      "venue":3,
      "created":1371383458,
      "text":"Foo 2"
   }
]
```

Optionally you can specify how many messages to receive maximum, and how many minimum for venues that have upcoming events:
```
GET /api/messages?maxMessages=500&minMessagesVenue=3 HTTP/1.1
Host: www.denkmal.org
```


## Send message
Request:
```
POST /api/message HTTP/1.1
Host: www.denkmal.org
content-type: text/plain
content-length: 65

venue=1&text=foobar&hash=<HASH>
```
Response:
```json
{
	"id":13,
	"venue":1,
	"created":1380379451,
{'fraction_non_alphanumeric': 0.1979107848673066, 'fraction_numerical': 0.07961603613777526, 'mean_word_length': 1.755054432348367, 'pattern_counts': {'":': 90, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 9, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4946869', 'n_tokens_mistral': 1506, 'n_tokens_neox': 1298, 'n_words': 205}