Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/17Franco/CulturarteWeb/llms.txt

Use this file to discover all available pages before exploring further.

The Trello integration allows administrators or front-end tooling to produce a structured Trello board for any Proponente in the system at the click of a button. The board gives the Proponente a visual, project-management-friendly overview of all their proposals and the collaborators backing each one — complete with collaboration amounts, return types, and dates. Each proposal becomes a Trello list, and each collaborator becomes a Trello card inside that list.

How It Works

Endpoint: GET /TrelloApi?nick=<proponente_nick> The servlet performs five steps in sequence:
  1. Fetches Proponente data from the REST service at http://<WEB_SERVICES_HOSTR>:<WEB_SERVICES_PORTR><SERVICER>/<nick>. The response is a JSON object containing the Proponente’s nickname and a propCreadas array.
  2. Creates a Trello board named "Propuestas de {nick}" via POST https://api.trello.com/1/boards/. Default lists are disabled (defaultLists=false).
  3. Creates one Trello list per proposal, named "{Titulo} {FechaPublicacionString}".
  4. Creates one Trello card per collaboration inside the corresponding proposal list. The card name is the collaborator’s nickname; the card description contains the monto, tipoRetorno, and fechaColaborado.
  5. Uploads the proposal image (if present) as a file attachment on a dedicated card inside the same list.

Step-by-Step Flow

1

Call the REST service to get Proponente data

The servlet issues a GET request to the configured REST endpoint for the given nick. The JSON response includes at minimum:
{
  "nickname": "hrubino",
  "propCreadas": [
    {
      "Titulo": "Religiosamente",
      "FechaPublicacionString": "2025-10-22",
      "Imagen": "IMG/MOM/MOMO.jpg",
      "img": "<base64-encoded image bytes>",
      "aporte": [
        {
          "colaborador": "Tiajaci",
          "monto": "500",
          "tipoRetorno": "EntradaGratis",
          "creadoString": "2017-07-01"
        }
      ]
    }
  ]
}
2

Create the Trello board

A POST request is sent to the Trello API to create a new board. Default lists are suppressed so the board starts empty.
POST https://api.trello.com/1/boards/
  ?name=Propuestas de hrubino
  &key=<API_KEY>
  &token=<API_TOKEN>
  &defaultLists=false
The response contains the new board’s id, which is used in all subsequent list-creation requests.
3

Create one list per proposal

For each entry in propCreadas, a Trello list is created inside the board:
POST https://api.trello.com/1/lists
  ?name=Religiosamente 2025-10-22
  &idBoard=<boardId>
  &key=<API_KEY>
  &token=<API_TOKEN>
The list id returned is saved for use when creating cards.
4

Create cards for each collaboration

For each element in the proposal’s aporte array, a Trello card is created inside the proposal’s list:
POST https://api.trello.com/1/cards
  ?name=Tiajaci
  &idList=<listId>
  &desc=Monto: 500\nTipo de retorno: EntradaGratis\nFecha colaborado: 2017-07-01
  &key=<API_KEY>
  &token=<API_TOKEN>
The card name is the collaborator’s nickname. The card description contains:
LineField
Monto: <value>Amount pledged
Tipo de retorno: <value>EntradaGratis or PorcentajeGanancia
Fecha colaborado: <value>Date the collaboration was created
5

Upload the proposal image as an attachment (if present)

If the proposal has both an Imagen path and a non-empty img (Base64-encoded bytes), an additional card is created in the list and the image is attached to it.
// Base64 image → temp file → Trello attachment
byte[] imagenBytes = java.util.Base64.getDecoder().decode(img);
File archivoImagen = File.createTempFile("trello_adjunto_", extension);
archivoImagen.deleteOnExit();
// ... write bytes to file ...

Unirest.post("https://api.trello.com/1/cards/" + idTarjeta + "/attachments")
    .field("file", archivoImagen, tipoImg)
    .queryString("key", apiKey)
    .queryString("token", apiToken)
    .asJson();
Supported image types: .jpg / .jpeg (image/jpeg) and .png (image/png). Any other extension falls back to application/octet-stream.
Images are decoded from the Base64 string returned by the REST service, written to a temporary file with File.createTempFile, and then uploaded to Trello as a multipart attachment. The temporary file is marked deleteOnExit() so it is cleaned up when the JVM exits.

Response

On success, the endpoint returns a JSON response body:
{ "mensaje": "Tablero en Trello creado exitosamente para: hrubino" }
On failure, an error message is returned instead:
{ "mensaje": "ERROR Creando tablero en Trello: <exception message>" }
If the required nick query parameter is missing or empty, the servlet returns immediately with:
{ "mensaje": "ERROR: falta nick" }

Configuration

The Trello API key and token, as well as the REST service host, must be set in ~/.Culturarte/config.properties. The same file also holds the SOAP web service coordinates; the Trello-specific keys are separate.
# REST service for Proponente data (used by TrelloApi)
WEB_SERVICES_HOSTR=localhost
WEB_SERVICES_PORTR=8080
SERVICER=/CulturarteREST/api/proponente

# Trello credentials
API_KEY=your_trello_api_key_here
API_TOKEN=your_trello_api_token_here

Obtaining Trello Credentials

  1. Log in to https://trello.com with the account that will own the generated boards.
  2. Navigate to https://trello.com/app-key to obtain your API Key.
  3. On the same page, click “Token” to generate a personal API Token for your account.
  4. Paste both values into config.properties under the keys API_KEY and API_TOKEN.

HTTP Timeouts

Image uploads to Trello can take several seconds depending on file size. The servlet overrides the default Unirest timeouts in its init() method to prevent premature failures:
@Override
public void init() throws ServletException {
    super.init();
    kong.unirest.Unirest.config()
        .connectTimeout(10000)   // 10 seconds to establish connection
        .socketTimeout(90000);   // 90 seconds for data transfer (covers image uploads)
}
If the socket timeout is exceeded during an image attachment upload, the Trello card itself may already exist but the attachment will be missing.
The /TrelloApi endpoint creates a brand-new Trello board on every call. There is no deduplication logic — if you call the endpoint multiple times for the same Proponente, you will end up with multiple identical boards in the Trello account. Treat this endpoint as a one-time export action, not a sync operation.

Build docs developers (and LLMs) love