Gobierto Plans / Plans

List plans

GET /api/v1/plans

{
    "data": [
        {
            "id": "46",
            "type": "gobierto_plans-plans",
            "attributes": {
                "slug": "plan-dashboards",
                "title": "Plan dashboards",
                "introduction": "Plan que contiene dashboards",
                "year": 2021,
                "visibility_level": "published",
                "css": "",
                "footer": null,
                "configuration_data": {
                    "level0": {
                        "one": {
                            "en": "axis",
                            "ca": "eix",
                            "es": "eje"
                        },
                        "other": {
                            "en": "axes",
                            "ca": "eixos",
                            "es": "ejes"
                        }
                    },
                    "level1": {
                        "one": {
                            "en": "line of activity",
                            "ca": "línia d'actuació",
                            "es": "línea de actuación"
                        },
                        "other": {
                            "en": "lines of activity",
                            "ca": "línies d'actuació",
                            "es": "líneas de actuación"
                        }
                    },
                    "level2": {
                        "one": {
                            "en": "activity",
                            "ca": "actuació",
                            "es": "actuación"
                        },
                        "other": {
                            "en": "activities",
                            "ca": "actuacions",
                            "es": "actuaciones"
                        }
                    },
                    "level3": {
                        "one": {
                            "en": "project/action",
                            "ca": "projecte/acció",
                            "es": "proyecto/acción"
                        },
                        "other": {
                            "en": "projects/actions",
                            "ca": "projectes/accions",
                            "es": "proyectos/acciones"
                        }
                    },
                    "level0_options": [],
                    "show_table_header": false,
                    "open_node": false,
                    "hide_level0_counters": false,
                    "sdg_uid": null,
                    "show_empty_fields": false
                },
                "links": {
                    "show": "/api/v1/plans/46",
                    "meta": "/api/v1/plans/46/meta"
                }
            }
        }//,
        //{ ... }
        // ...
    ],
    "links": {
        "self": "/api/v1/plans"
    }
}

Get a single plan

GET /api/v1/plans/

{
    "data": {
        "id": "46",
        "type": "gobierto_plans-plans",
        "attributes": {
            "slug": "plan-dashboards",
            "title": "Plan dashboards",
            "introduction": "Plan que contiene dashboards",
            "year": 2021,
            "visibility_level": "published",
            "css": "",
            "footer": null,
            "configuration_data": {
                "level0": {
                    "one": {
                        "en": "axis",
                        "ca": "eix",
                        "es": "eje"
                    },
                    "other": {
                        "en": "axes",
                        "ca": "eixos",
                        "es": "ejes"
                    }
                },
                "level1": {
                    "one": {
                        "en": "line of activity",
                        "ca": "línia d'actuació",
                        "es": "línea de actuación"
                    },
                    "other": {
                        "en": "lines of activity",
                        "ca": "línies d'actuació",
                        "es": "líneas de actuación"
                    }
                },
                "level2": {
                    "one": {
                        "en": "activity",
                        "ca": "actuació",
                        "es": "actuación"
                    },
                    "other": {
                        "en": "activities",
                        "ca": "actuacions",
                        "es": "actuaciones"
                    }
                },
                "level3": {
                    "one": {
                        "en": "project/action",
                        "ca": "projecte/acció",
                        "es": "proyecto/acción"
                    },
                    "other": {
                        "en": "projects/actions",
                        "ca": "projectes/accions",
                        "es": "proyectos/acciones"
                    }
                },
                "level0_options": [],
                "show_table_header": false,
                "open_node": false,
                "hide_level0_counters": false,
                "sdg_uid": null,
                "show_empty_fields": false
            },
            "categories_vocabulary_terms": [
                {
                    "id": "9199",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Población general",
                        "description": null,
                        "slug": "poblacion-general",
                        "position": 0,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "9200",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Personas de edad avanzada",
                        "description": null,
                        "slug": "personas-de-edad-avanzada",
                        "position": 1,
                        "level": 0,
                        "term_id": null
                    }
                }
            ],
            "statuses_vocabulary_terms": [
                {
                    "id": "3402",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Terminada",
                        "description": null,
                        "slug": "terminada",
                        "position": 0,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3401",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Aplazada",
                        "description": null,
                        "slug": "aplazada",
                        "position": 0,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3400",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Planificada",
                        "description": null,
                        "slug": "planificada",
                        "position": 0,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3399",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "En ejecución",
                        "description": null,
                        "slug": "en-ejecucion",
                        "position": 0,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3446",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "new",
                        "description": null,
                        "slug": "new",
                        "position": 1,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3447",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "test",
                        "description": null,
                        "slug": "test",
                        "position": 2,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3448",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Ámbito",
                        "description": null,
                        "slug": "ambito",
                        "position": 3,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3449",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Erróneo",
                        "description": null,
                        "slug": "err-oneo",
                        "position": 4,
                        "level": 0,
                        "term_id": null
                    }
                }
            ],
            "links": {
                "show": "/api/v1/plans/46",
                "meta": "/api/v1/plans/46/meta"
            }
        },
        "relationships": {
            "plan_type": {
                "data": {
                    "id": 7,
                    "created_at": "2018-07-06T16:54:41.791+02:00",
                    "updated_at": "2021-01-18T11:00:28.689+01:00",
                    "slug": "plan-de-gobierno",
                    "name_translations": {
                        "ca": "",
                        "en": "",
                        "es": "Plan de Gobierno"
                    },
                    "site_id": 2
                }
            }
        }
    }
}

Get admin data of a single plan

This endpoint is only available to admin and the response provides projects data and can be used to update the plan and its projects

GET /api/v1/plans/<id>/admin

Headers:

  • Authorization: Bearer TOKEN A valid token of an admin with permissions to create terms must be provided

Example of response:

{
    "data": {
        "id": "46",
        "type": "gobierto_plans-plans",
        "attributes": {
            "slug": "plan-dashboards",
            "title_translations": {
                "ca": "",
                "en": "",
                "es": "Plan dashboards"
            },
            "introduction_translations": {
                "ca": "",
                "en": "",
                "es": "Plan que contiene dashboards"
            },
            "configuration_data": {
                "level0": {
                    "one": {
                        "en": "axis",
                        "ca": "eix",
                        "es": "eje"
                    },
                    "other": {
                        "en": "axes",
                        "ca": "eixos",
                        "es": "ejes"
                    }
                },
                "level1": {
                    "one": {
                        "en": "line of activity",
                        "ca": "línia d'actuació",
                        "es": "línea de actuación"
                    },
                    "other": {
                        "en": "lines of activity",
                        "ca": "línies d'actuació",
                        "es": "líneas de actuación"
                    }
                },
                "level2": {
                    "one": {
                        "en": "activity",
                        "ca": "actuació",
                        "es": "actuación"
                    },
                    "other": {
                        "en": "activities",
                        "ca": "actuacions",
                        "es": "actuaciones"
                    }
                },
                "level3": {
                    "one": {
                        "en": "project/action",
                        "ca": "projecte/acció",
                        "es": "proyecto/acción"
                    },
                    "other": {
                        "en": "projects/actions",
                        "ca": "projectes/accions",
                        "es": "proyectos/acciones"
                    }
                },
                "level0_options": [],
                "show_table_header": false,
                "open_node": false,
                "hide_level0_counters": false,
                "sdg_uid": null,
                "fields_to_not_show_in_front": [],
                "show_empty_fields": false
            },
            "year": 2021,
            "visibility_level": "published",
            "css": "",
            "footer_translations": {
                "ca": "",
                "en": "",
                "es": ""
            },
            "categories_vocabulary_terms": [
                {
                    "id": "9199",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Población general",
                        "description": null,
                        "slug": "poblacion-general",
                        "position": 0,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "9200",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Personas de edad avanzada",
                        "description": null,
                        "slug": "personas-de-edad-avanzada",
                        "position": 1,
                        "level": 0,
                        "term_id": null
                    }
                }
            ],
            "statuses_vocabulary_terms": [
                {
                    "id": "3402",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Terminada",
                        "description": null,
                        "slug": "terminada",
                        "position": 0,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3401",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Aplazada",
                        "description": null,
                        "slug": "aplazada",
                        "position": 0,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3400",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Planificada",
                        "description": null,
                        "slug": "planificada",
                        "position": 0,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3399",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "En ejecución",
                        "description": null,
                        "slug": "en-ejecucion",
                        "position": 0,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3446",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "new",
                        "description": null,
                        "slug": "new",
                        "position": 1,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3447",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "test",
                        "description": null,
                        "slug": "test",
                        "position": 2,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3448",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Ámbito",
                        "description": null,
                        "slug": "ambito",
                        "position": 3,
                        "level": 0,
                        "term_id": null
                    }
                },
                {
                    "id": "3449",
                    "type": "gobierto_common-terms",
                    "attributes": {
                        "name": "Erróneo",
                        "description": null,
                        "slug": "err-oneo",
                        "position": 4,
                        "level": 0,
                        "term_id": null
                    }
                }
            ],
            "projects": [
                {
                    "id": 13264,
                    "external_id": null,
                    "visibility_level": null,
                    "moderation_stage": "not_sent",
                    "name_translations": {
                        "ca": "",
                        "en": "Dashboards project",
                        "es": "Proyecto de cuadros de mando"
                    },
                    "category_id": 9199,
                    "category_external_id": null,
                    "status_id": 3399,
                    "status_external_id": null,
                    "progress": 0.0,
                    "starts_at": "2020-03-14",
                    "ends_at": "2020-12-31",
                    "position": null
                },
                {
                    "id": 13265,
                    "external_id": "2",
                    "visibility_level": "published",
                    "moderation_stage": "not_sent",
                    "name_translations": {
                        "ca": "",
                        "en": "Dashboards alternative project",
                        "es": "Proyecto alternativo de cuadros de mando"
                    },
                    "category_id": 9199,
                    "category_external_id": null,
                    "status_id": 3402,
                    "status_external_id": null,
                    "progress": 0.0,
                    "starts_at": "2021-01-01",
                    "ends_at": "2022-12-31",
                    "position": null
                }
            ]
        },
        "relationships": {
            "plan_type": {
                "data": {
                    "id": 7,
                    "created_at": "2018-07-06T16:54:41.791+02:00",
                    "updated_at": "2021-01-18T11:00:28.689+01:00",
                    "slug": "plan-de-gobierno",
                    "name_translations": {
                        "ca": "",
                        "en": "",
                        "es": "Plan de Gobierno"
                    },
                    "site_id": 2
                }
            }
        }
    }
}

Update a plan

PUT /api/v1/plans/

Updates an existing plan. The request must include a valid token of an authorized admin.

The plan identifier of the URL can be both:

  • the plan internal id
  • the plan slug if exists

The body of the request should include only the attributes that needs to be updated. Any attribute in the body will be updated.

Headers:

  • Authorization: Bearer TOKEN A valid token of an admin with permissions to create terms must be provided

Attributes: the same attributes that in the Create a plan section. The projects array can include the id or external_id of the projects to update them. Each project not found by external_idwill be created