| ... | ... | @@ -94,21 +94,32 @@ Errors específics que retorna la REST API de Wordpress: |
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
URL: https://somcomunitats.coop/wp-json/wp/v2/ce_community
|
|
|
|
|
|
|
|
## POST
|
|
|
|
|
|
|
|
Per crear una CE, cal passar a la petició POST un payload amb la següent informació:
|
|
|
|
Per crear una CE, cal passar a la petició POST a https://somcomunitats.coop/wp-json/wp/v2/rest_ce_community amb el següent payload:
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
|
|
{
|
|
|
|
title:"test-desde-bash",
|
|
|
|
"odoo_company_id":"5"
|
|
|
|
title:"títol del post",
|
|
|
|
"odoo_company_id":"número de la company"
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
En el següent exemple creem un nou post per una nova CE, amb títol "test-desde-bash" i associat a la company 5. Hem de passar el token obtingut un cop s'ha realitzat l'autenticació amb JWT. La resposta en cas d'èxit és la següent:
|
|
|
|
En el següent exemple creem un nou post per una nova CE, amb títol "test-desde-bash" i associat a la company 5. Hem de passar el token obtingut un cop s'ha realitzat l'autenticació amb JWT.
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
headers:'Content-Type: application/json',
|
|
|
|
"Authorization:Bearer $token",
|
|
|
|
"domain": "/wp/v2/rest_ce_community"
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
La resposta en cas d'èxit és la següent:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
| ... | ... | @@ -183,10 +194,6 @@ En el següent exemple creem un nou post per una nova CE, amb títol "test-desde |
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
headers: 'Content-Type: application/json', "Authorization: Bearer $token"
|
|
|
|
domain: /wp/v2/rest_ce_community
|
|
|
|
|
|
|
|
`
|
|
|
|
POST /wp-json/wp/v2/posts/42 HTTP/1.1
|
|
|
|
Host: example.com
|
| ... | ... | |
| ... | ... | |