Skip to main content

Get Monitors List

curl -X GET https://api.sociapp.com/activities/Monitors \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
[
  {
    "IdUsuario": 5,
    "nombre": "María",
    "apellidos": "Rodríguez Sánchez",
    "categoria": "monitor",
    "email": "[email protected]",
    "telefono": "+34 600 111 222"
  },
  {
    "IdUsuario": 12,
    "nombre": "Carlos",
    "apellidos": "Martínez López",
    "categoria": "monitor",
    "email": "[email protected]",
    "telefono": "+34 600 333 444"
  }
]

Endpoint

GET /activities/Monitors

Authentication

Required: JWT Bearer token with monitor or admin role

Response

Returns an array of user objects with category “monitor” who can be assigned to activities.
IdUsuario
number
Unique user identifier
nombre
string
Monitor’s first name
apellidos
string
Monitor’s last name(s)
categoria
string
User category (will always be “monitor”)
email
string
Monitor’s email address
telefono
string
Monitor’s phone number

Use Cases

This endpoint is used when:
  • Creating a new activity that needs a monitor assignment
  • Editing an existing activity to change the assigned monitor
  • Populating a dropdown/select field with available monitors
  • Displaying monitor contact information

Example Integration

// Fetch monitors for activity form
async function loadMonitorsForForm() {
  try {
    const response = await fetch('/activities/Monitors', {
      headers: {
        'Authorization': `Bearer ${accessToken}`
      }
    });
    
    const monitors = await response.json();
    
    // Populate select dropdown
    const selectElement = document.getElementById('monitor-select');
    monitors.forEach(monitor => {
      const option = document.createElement('option');
      option.value = monitor.IdUsuario;
      option.textContent = `${monitor.nombre} ${monitor.apellidos}`;
      selectElement.appendChild(option);
    });
  } catch (error) {
    console.error('Failed to load monitors:', error);
  }
}

Vue.js Component Example

<template>
  <div>
    <label>Assign Monitor</label>
    <select v-model="selectedMonitor">
      <option :value="null">No monitor assigned</option>
      <option 
        v-for="monitor in monitors" 
        :key="monitor.IdUsuario"
        :value="monitor.IdUsuario"
      >
        {{ monitor.nombre }} {{ monitor.apellidos }}
      </option>
    </select>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';

const monitors = ref([]);
const selectedMonitor = ref(null);

onMounted(async () => {
  const response = await fetch('/activities/Monitors', {
    headers: { 'Authorization': `Bearer ${accessToken}` }
  });
  monitors.value = await response.json();
});
</script>

Build docs developers (and LLMs) love