# Idea

## Content

* [Endpoints](#endpoints)
* [ExtraData](#extradata)
* [ToDo](#todo)

## Endpoints

`GET /api/site/:SITE_ID/idea/` list all ideas

`POST /api/site/:SITE_ID/idea/` create an idea

`GET /api/site/:SITE_ID/idea/:IDEA_ID` view one idea

`PUT /api/site/:SITE_ID/idea/:IDEA_ID` update one idea

`DELETE /api/site/:SITE_ID/idea/:IDEA_ID` delete one idea

GET request are public, POST are only accessible to owners or moderators.

To include more data there are a few get parameters available:

`selectRunning` `includeArguments` `includePosterImage` `includeUser` `includeVoteCount` `includeUserVote`

## extraData

Ideas contain an extraData field for dynamic data that changes per site. The allowed values are configurable per site (it's own rest object)

Supported field types: `boolean` `int` `string` `arrayOfStrings` `enum` `object`

Object is a special case; it requires a subset of definitions (see example). These will be checked recursively.

Removing fields is done by sending them with value `null`.

#### extraDataMustBeDefined

In old versions ist wasn't required to define the extraData values in the site configuration, therefore by default the check is not made at the moment. However extraDataMustBeDefined: true forces the validation, and will soon be the default.

#### Example configuration

```
  "config": {
    "ideas": {
      "extraData": {
        "zomaar": {
          "type": "object",
          "subset": {
            "zomaar sub1": {
              "type": "string",
              "allowNull": true
            },
            "zomaar sub2": {
              "type": "boolean",
              "allowNull": true
            }
          },
          "allowNull": false
        },
        "images": {
          "type": "arrayOfStrings",
          "allowNull": true
        },
        "gebied": {
          "type": "enum",
          "values": [
            "Oud-West",
            "Bos en Lommer",
            "De Baarsjes",
            "Westerpark",
            "West Algemeen"
          ],
          "allowNull": false,
        }
      }
    }
  }
```

Example data:

```
  "extraData": {
    "zomaar": {
      "zomaar sub1": "Boe",
      "zomaar sub2": true
    },
    "gebied": "De Baarsjes",
    "images": [
      "https://image-server.staging.openstadsdeel.nl/image/kleine-wereld-6428.jpg"
    ]
  }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openstad.org/openstad/technical/api/resource-idea.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
