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 TOKENA 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
slugif exists
The body of the request should include only the attributes that need to be updated. Any attribute in the body will be updated..
Headers:
Authorization:Bearer TOKENA valid token of an admin with permissions to create terms must be provided
Request Body Parameters
Plan Attributes
slug(string, optional): A unique identifier for the plan. Used in URLs and must be URL-friendly.title_translations(object, optional): Translations of the plan title. Keys are language codes (e.g., "en", "es", "ca").introduction_translations(object, optional): Translations of the plan introduction/description. Keys are language codes.year(integer, optional): The year associated with the plan.visibility_level(string, optional): The visibility level of the plan. Common values: "published", "draft".css(string, optional): Custom CSS styles for the plan.footer_translations(object, optional): Translations of the plan footer text. Keys are language codes.configuration_data(object, optional): Configuration object for the plan structure. Contains:level0,level1,level2,level3(object, optional): Definitions for each hierarchy level withoneandotherkeys for singular/plural translations.level0_options(array, optional): Options for level 0.show_table_header(boolean, optional): Whether to show table headers.open_node(boolean, optional): Whether nodes should be open by default.hide_level0_counters(boolean, optional): Whether to hide counters at level 0.sdg_uid(string, optional): SDG (Sustainable Development Goals) unique identifier.show_empty_fields(boolean, optional): Whether to show empty fields.fields_to_not_show_in_front(array, optional): List of field UIDs to hide in the frontend.
categories_vocabulary(string|integer, optional): Slug or ID of an existing vocabulary to use for categories. If not provided, a new vocabulary will be created.statuses_vocabulary(string|integer, optional): Slug or ID of an existing vocabulary to use for statuses. If not provided, a new vocabulary will be created.plan_type_id(integer, optional): ID of the plan type. Usually not changed after creation.
Reset Plan
-
reset_plan(boolean, optional): When set totrue, this will delete all existing content from the plan before applying updates:- All projects (nodes) are deleted
- All category vocabulary terms are deleted
- All status vocabulary terms are deleted
- All terms from vocabularies related to custom fields are deleted
This is useful when you want to completely replace the plan's content. After reset, you can provide new
categories_vocabulary_terms,statuses_vocabulary_terms, andprojectsarrays to populate the plan with fresh data.
Vocabulary Terms
-
categories_vocabulary_terms(array, optional): Array of category terms to create or update. Each term object can contain:name_translations(object, required): Translations of the term name. Keys are language codes.description_translations(object, optional): Translations of the term description. Keys are language codes.slug(string, optional): URL-friendly identifier for the term. Auto-generated if not provided.position(integer, optional): Position/order of the term in the vocabulary.level(integer, optional): Hierarchy level of the term (0 for root level).parent_id(string|integer, optional): ID or external_id of the parent term for hierarchical structures. Usenullfor root-level terms.external_id(string, optional): External identifier for the term. Used to reference terms from external systems.
-
statuses_vocabulary_terms(array, optional): Array of status terms to create or update. Same structure ascategories_vocabulary_terms.
Projects
projects(array, optional): Array of projects to create or update. Each project object can contain:id(integer, optional): Internal ID of the project. Use this to update an existing project.external_id(string, optional): External identifier for the project. Used to reference projects from external systems. If provided and no project with thisexternal_idexists, a new project will be created. If a project with thisexternal_idexists, it will be updated.name_translations(object, required): Translations of the project name. Keys are language codes.visibility_level(string, optional): Visibility level of the project. Common values: "published", "draft".moderation_stage(string, optional): Moderation stage of the project. Common values: "approved", "not_sent", "pending".category_id(integer, optional): Internal ID of the category term. Alternative tocategory_external_id.category_external_id(string, optional): External ID of the category term. Used to reference categories by their external identifier.status_id(integer, optional): Internal ID of the status term. Alternative tostatus_external_id.status_external_id(string, optional): External ID of the status term. Used to reference statuses by their external identifier.progress(float, optional): Progress percentage of the project (0.0 to 100.0).starts_at(string, optional): Start date of the project in ISO format (YYYY-MM-DD).ends_at(string, optional): End date of the project in ISO format (YYYY-MM-DD).position(integer, optional): Position/order of the project.
Note: When updating projects, you can use either id or external_id to identify existing projects. Projects not found by external_id will be created as new projects.
Example Request
{
"data": {
"attributes": {
"title_translations": {
"en": "Updated Plan Title",
"es": "Título del Plan Actualizado"
},
"year": 2024,
"projects": [
{
"external_id": "1",
"name_translations": {
"en": "Updated Project Name",
"es": "Nombre del Proyecto Actualizado"
},
"category_external_id": "4",
"status_external_id": "2",
"progress": 75.0,
"visibility_level": "published",
"moderation_stage": "approved"
}
]
}
}
}
Example Request with Reset
{
"data": {
"attributes": {
"reset_plan": true,
"categories_vocabulary_terms": [
{
"name_translations": {
"en": "New Category",
"es": "Nueva Categoría"
},
"external_id": "CAT-1",
"position": 0,
"level": 0,
"parent_id": null
}
],
"statuses_vocabulary_terms": [
{
"name_translations": {
"en": "In Progress",
"es": "En Progreso"
},
"external_id": "STATUS-1",
"position": 0,
"level": 0,
"parent_id": null
}
],
"projects": [
{
"external_id": "PRJ-1",
"name_translations": {
"en": "New Project",
"es": "Nuevo Proyecto"
},
"category_external_id": "CAT-1",
"status_external_id": "STATUS-1",
"progress": 50.0,
"visibility_level": "published",
"moderation_stage": "approved"
}
]
}
}
}
Response
The response follows the same structure as the "Get admin data of a single plan" endpoint, returning the updated plan with all its attributes, vocabulary terms, and projects.
Updated 15 days ago
