| ... | ... | @@ -158,9 +158,95 @@ Host: example.com |
|
|
|
X-HTTP-Method-Override: DELETE
|
|
|
|
`
|
|
|
|
## PUT
|
|
|
|
Com actualitzar una landing
|
|
|
|
Per actualitzar el l'estat o algún dels paràmetres de la landing, cal actualitzar els valors a modificar de la payload i passar l'id de la landing a modificar:
|
|
|
|
|
|
|
|
' https://somcomunitats.coop/wp-json/wp/v2/rest-ce-landing/id-landing'
|
|
|
|
La resposta d'èxit de la petició, ens retornarà el mateix posts amb els valors modificats. En aquest cas, hem modificat l'status del post anterior, de 'publish' a 'draft'
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
|
|
|
{
|
|
|
|
"id": 1715,
|
|
|
|
"date": "2023-03-02T12:16:40",
|
|
|
|
"date_gmt": "2023-03-02T12:16:40",
|
|
|
|
"guid": {
|
|
|
|
"rendered": "https:\/\/somcomunitats.coop\/rest-ce-landing\/test-ce-publica\/",
|
|
|
|
"raw": "https:\/\/somcomunitats.coop\/rest-ce-landing\/test-ce-publica\/"
|
|
|
|
},
|
|
|
|
"modified": "2023-03-02T12:27:35",
|
|
|
|
"modified_gmt": "2023-03-02T12:27:35",
|
|
|
|
"password": "",
|
|
|
|
"slug": "test-ce-publica",
|
|
|
|
"status": "draft",
|
|
|
|
"type": "rest-ce-landing",
|
|
|
|
"link": "https:\/\/somcomunitats.coop\/?post_type=rest-ce-landing&p=1715",
|
|
|
|
"title": {
|
|
|
|
"raw": "test-CE-publica",
|
|
|
|
"rendered": "test-CE-publica"
|
|
|
|
},
|
|
|
|
"content": {
|
|
|
|
"raw": "",
|
|
|
|
"rendered": "",
|
|
|
|
"protected": false,
|
|
|
|
"block_version": 0
|
|
|
|
},
|
|
|
|
"author": 5,
|
|
|
|
"comment_status": "open",
|
|
|
|
"ping_status": "closed",
|
|
|
|
"template": "",
|
|
|
|
"permalink_template": "https:\/\/somcomunitats.coop\/rest-ce-landing\/%pagename%\/",
|
|
|
|
"generated_slug": "test-ce-publica",
|
|
|
|
"odoo_company_id": "5",
|
|
|
|
"_links": {...}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## DELETE
|
|
|
|
Com esborrar una landing
|
|
|
|
|
|
|
|
Per esborrar una landing, cal apuntar a la URL de la landing en qüestió, com en el mètode PUT.
|
|
|
|
|
|
|
|
La resposta d'èxit ens retornarà el post amb l'status de 'trash'
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"id": 1715,
|
|
|
|
"date": "2023-03-02T12:16:40",
|
|
|
|
"date_gmt": "2023-03-02T12:16:40",
|
|
|
|
"guid": {
|
|
|
|
"rendered": "https:\/\/somcomunitats.coop\/rest-ce-landing\/test-ce-publica\/",
|
|
|
|
"raw": "https:\/\/somcomunitats.coop\/rest-ce-landing\/test-ce-publica\/"
|
|
|
|
},
|
|
|
|
"modified": "2023-03-02T12:33:24",
|
|
|
|
"modified_gmt": "2023-03-02T12:33:24",
|
|
|
|
"password": "",
|
|
|
|
"slug": "test-ce-publica__trashed",
|
|
|
|
"status": "trash",
|
|
|
|
"type": "rest-ce-landing",
|
|
|
|
"link": "https:\/\/somcomunitats.coop\/?post_type=rest-ce-landing&p=1715",
|
|
|
|
"title": {
|
|
|
|
"raw": "test-CE-publica",
|
|
|
|
"rendered": "test-CE-publica"
|
|
|
|
},
|
|
|
|
"content": {
|
|
|
|
"raw": "",
|
|
|
|
"rendered": "",
|
|
|
|
"protected": false,
|
|
|
|
"block_version": 0
|
|
|
|
},
|
|
|
|
"author": 5,
|
|
|
|
"comment_status": "open",
|
|
|
|
"ping_status": "closed",
|
|
|
|
"template": "",
|
|
|
|
"permalink_template": "https:\/\/somcomunitats.coop\/rest-ce-landing\/%pagename%\/",
|
|
|
|
"generated_slug": "test-ce-publica",
|
|
|
|
"odoo_company_id": "5",
|
|
|
|
"_links": {...}
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
# **Connexió Wordpress -> Odoo. Què espera la REST API de Wordpress quan fa una petició GET a Odoo:**
|
|
|
|
|
| ... | ... | |
| ... | ... | |