|
|
|
### **Connexió Odoo -> Wordpress. Què necessita la REST API de Wordpress per fer les següents accions desde Odoo:**
|
|
|
|
|
|
|
|
#### GET: https://somcomunitats.coop/wp-json/wp/v2/ce_community/
|
|
|
|
#### GET: https://somcomunitats.coop/wp-json/wp/v2/rest_ce_community
|
|
|
|
|
|
|
|
Retorna la informació de tots els posts de les comunitats energètiques. Si afegim l'ID de la comunitat com a paràmetre, https://somcomunitats.coop/wp-json/wp/v2/ce_community/1382, rebrem com a resposta la següent informació:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
|
|
|
|
"id":1382,
|
|
|
|
"date":"2022-10-25T08:59:41",
|
|
|
|
"date_gmt":"2022-10-25T08:59:41",
|
|
|
|
"id":1709,
|
|
|
|
"date":"2023-01-05T12:08:34",
|
|
|
|
"date_gmt":"2023-01-05T12:08:34",
|
|
|
|
"guid":{
|
|
|
|
"rendered":"https:\/\/somcomunitats.coop\/?post_type=ce_community&p=1382"
|
|
|
|
"rendered":"https:\/\/somcomunitats.coop\/?post_type=rest_ce_community&p=1709"
|
|
|
|
},
|
|
|
|
"modified":"2022-11-07T11:22:15",
|
|
|
|
"modified_gmt":"2022-11-07T11:22:15",
|
|
|
|
"slug":"comunitat-energetica-de-mediona",
|
|
|
|
"modified":"2023-03-01T12:18:21",
|
|
|
|
"modified_gmt":"2023-03-01T12:18:21",
|
|
|
|
"slug":"comunitat-rest-de-prova",
|
|
|
|
"status":"publish",
|
|
|
|
"type":"ce_community",
|
|
|
|
"link":"https:\/\/somcomunitats.coop\/ce\/comunitat-energetica-de-mediona\/",
|
|
|
|
"type":"rest_ce_community",
|
|
|
|
"link":"https:\/\/somcomunitats.coop\/rest-ce\/comunitat-rest-de-prova\/",
|
|
|
|
"title":{
|
|
|
|
"rendered":"Comunitat Energ\u00e8tica de Mediona"
|
|
|
|
"rendered":"Comunitat REST de prova"
|
|
|
|
},
|
|
|
|
"content":{},
|
|
|
|
"author":1,
|
|
|
|
"content":{
|
|
|
|
"rendered":"",
|
|
|
|
"protected":false
|
|
|
|
},
|
|
|
|
"author":5,
|
|
|
|
"comment_status":"open",
|
|
|
|
"ping_status":"closed",
|
|
|
|
"template":"",
|
|
|
|
"odoo_company_id":"5",
|
|
|
|
"_links":{
|
|
|
|
"self":[
|
|
|
|
{}
|
|
|
|
{
|
|
|
|
"href":"https:\/\/somcomunitats.coop\/wp-json\/wp\/v2\/rest_ce_community\/1709"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"collection":[
|
|
|
|
{}
|
|
|
|
{
|
|
|
|
"href":"https:\/\/somcomunitats.coop\/wp-json\/wp\/v2\/rest_ce_community"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"about":[
|
|
|
|
{}
|
|
|
|
{
|
|
|
|
"href":"https:\/\/somcomunitats.coop\/wp-json\/wp\/v2\/types\/rest_ce_community"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"author":[
|
|
|
|
{}
|
|
|
|
{
|
|
|
|
"embeddable":true,
|
|
|
|
"href":"https:\/\/somcomunitats.coop\/wp-json\/wp\/v2\/users\/5"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"replies":[
|
|
|
|
{}
|
|
|
|
{
|
|
|
|
"embeddable":true,
|
|
|
|
"href":"https:\/\/somcomunitats.coop\/wp-json\/wp\/v2\/comments?post=1709"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"wp:attachment":[
|
|
|
|
{}
|
|
|
|
{
|
|
|
|
"href":"https:\/\/somcomunitats.coop\/wp-json\/wp\/v2\/media?parent=1709"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"curies":[
|
|
|
|
{}
|
|
|
|
{
|
|
|
|
"name":"wp",
|
|
|
|
"href":"https:\/\/api.w.org\/{rel}",
|
|
|
|
"templated":true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
| ... | ... | |
| ... | ... | |