gancio-upstream/docs/dev/api.md

96 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2020-02-02 21:08:16 +01:00
---
layout: default
title: API
permalink: /dev/api
parent: Hacking
nav_order: 8
---
1. TOC
{:toc}
2022-03-11 23:18:33 +01:00
## Get events
2020-02-02 21:08:16 +01:00
2022-03-11 23:18:33 +01:00
GET
{: .label .label-green}
**`/api/events`**
**Params**
| start | `integer` | start timestamp (default: now) |
| end | `integer` | end timestamp (optional) |
| tags | `array` | List of tags |
| places | `array` | List of places |
| max | `integer` | Max events |
| show_recurrent | `boolean` | Show also recurrent events (default: as choosen in admin settings) |
2020-02-02 21:08:16 +01:00
2022-03-11 23:18:33 +01:00
***Example***
[https://demo.gancio.org/api/events](https://demo.gancio.org/api/events)
[usage example](https://framagit.org/les/gancio/-/blob/master/webcomponents/src/GancioEvents.svelte#L18-42)
---
2020-02-02 21:08:16 +01:00
## Add a new event
POST
{: .label .label-orange}
2022-03-11 23:18:33 +01:00
**`/api/event`**
2020-02-02 21:08:16 +01:00
> info "info"
2021-06-04 20:37:19 +02:00
> `Content-Type` has to be `multipart/form-data` to support image upload
2020-02-02 21:08:16 +01:00
**Params**
| title | `string` | event's title |
| description | `string` | event's description (html accepted and sanitized) |
| place_name | `string` | the name of the place |
| place_address | `string` | the address of the place |
| place_latitude | `float` | the latitude of the place |
| place_longitude | `float` | the longitude of the place |
| online_locations | `array` | List of online locations |
2020-02-02 21:08:16 +01:00
| start_datetime | `integer` | start timestamp |
| multidate | `integer` | is a multidate event? |
| tags | `array` | List of tags |
| recurrent | `object` | Recurrent event details |
| recurrent.frequency | `string` | could be `1w` or `2w` |
| recurrent.days | `array` | array of days |
| image | `image` | Image |
---
## Get current authenticated user
GET
{: .label .label-green}
**`/api/user`**
**Response**
```json
2022-03-11 23:18:33 +01:00
{
"description" : null,
"recover_code" : "",
"id" : 1,
"createdAt" : "2020-01-29T18:10:16.630Z",
"updatedAt" : "2020-01-30T22:42:14.789Z",
"is_active" : true,
"settings" : "{}",
"email" : "eventi@cisti.org",
"is_admin" : true
}
```
2020-02-02 21:08:16 +01:00
---