dis-moi / dis-moi/backend

POST contribution endpoint on API V4

Open
#406 2 comments 1 reaction 1 assignee Claimed by @Goutte View on GitHub
API :robot: Size M :shirt:
Dominant language
PHP
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

We need the same POST /contributions endpoint we have on V3, but with the authentified V4 

Ideally, a body as simple as for the V3, but without contributor information (as we are already authentified)  would be light and enough for the extension use case :

```ts
{
url: string,
message: string,
}
```

If this is too complicated with API platform, then we need an extension of the existing POST /notices

from

```json
{
"visibility": "private",
"matchingContexts": [
{
"exampleUrl": "string",
"urlRegex": "string",
"excludeUrlRegex": "string",
"description": "string",
"querySelector": "string",
"xpath": "string"
}
],
"contributor": "string",
"message": "string",
"expires": "2031-11-05T00:00:00+02:00"
}
```

to (at least) :

```json
{
"matchingContexts": [
{
"exampleUrl": "string",
"urlRegex": "string",
"description": "string",
"domainNames": [
{
"name": "some.domain.com"
}
]
}
],
"message": "string",
}
```

This endpoint, when used by a standard user, should
- not authorize setting of creation date, contributor, visibility,
- create the domainName if not existing, or link the relation if already exists

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.