Branches
Manage branches within your university system via the uniR API.
An Academic Branch refers to a specific subdivision or specialization within an academic program that focuses on a particular area of study or discipline.
Branches allow students to tailor their education by concentrating on a specific field, providing depth and expertise beyond the general curriculum of the main program.
Typically, a branch:
- Is linked to a parent academic program.
- Has its own set of required and elective courses.
- Represents a distinct pathway or focus area (e.g., Software Engineering branch within Computer Science program).
Helps organize departmental resources and faculty expertise.
Base Path: api/academics/branches
Accessing Branches
Section titled “Accessing Branches”Branches are not listed independently. Instead, use the Academic Programs endpoints to retrieve branches linked to a specific program.
Retrieve Branch Details by ID
Section titled “Retrieve Branch Details by ID”GET /api/academics/branches/{id}
Query Parameters
Name | Type | Description |
---|---|---|
id | unsigned int | Unique identifier of the branch |
Example Request
curl -H x-api-key: Bearer YOUR_API_KEY \ https://api.unir.com/v1/api/academics/branches/123
fetch('https://api.unir.com/v1/api/academics/branches/123', { headers: { 'x-api-key': 'Bearer YOUR_API_KEY' }}).then(response => response.json()).then(data => console.log(data)).catch(console.error);
import axios from 'axios';
axios.get('https://api.unir.com/v1/api/academics/branches/123', { headers: { 'x-api-key': 'Bearer YOUR_API_KEY' }}).then(response => console.log(response.data)).catch(console.error);
or
import axios from 'axios';
axios.get('https://api.unir.com/v1/api/academics/branches/123', { headers: { 'x-api-key': 'Bearer YOUR_API_KEY' }}).then(response => console.log(response.data)).catch(console.error);
using System;using System.Net.Http;using System.Threading.Tasks;
class Program{ static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Add("x-api-key", "Bearer YOUR_API_KEY");
var response = await client.GetAsync("https://api.unir.com/v1/api/academics/branches/123"); response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); }}
Responses
{ "id": 0, "name": "string", "description": "string", "years": [ { "id": 0, "code": "string", "year": 0 } ]}
branch does not or no longer exists
- Missing or invalid API KEY.
- User is not authenticated.
Creating a Branch
Section titled “Creating a Branch”POST /api/academics/branches
Create a new academic branch under a program.
{ "programId": 0, "name": "string", "years": 0, "codePrefix": "string", "codeIsNumeric": true, "description": "string"}
Example Request
curl -X POST \ -H "x-api-key: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"programId": 0, "name": "string", "years": 0, "codePrefix": "string", "codeIsNumeric": true, "description": "string"}' \ https://api.unir.com/v1/api/academics/branches
fetch('https://api.unir.com/v1/api/academics/branches', { method: 'POST', headers: { 'x-api-key': 'Bearer YOUR_API_KEY', }, body: JSON.stringify({ programId: 0, name: 'string', years: 0, codePrefix: 'string', codeIsNumeric: true, description: 'string' })}).then(response => response.json()).then(data => console.log(data)).catch(console.error);
import axios from 'axios';
axios.post('https://api.unir.com/v1/api/academics/branches/123', { programId: 0, name: 'string', years: 0, codePrefix: 'string', codeIsNumeric: true, description: 'string' }, { headers: { 'x-api-key': 'Bearer YOUR_API_KEY', } }).then(response => console.log(response.data)).catch(console.error);
or
import axios from 'axios';
axios.defaults.headers.common['x-api-key'] = 'Bearer YOUR_API_KEY';
axios.post('https://api.unir.com/v1/api/academics/branches', { programId: 0, name: 'string', years: 0, codePrefix: 'string', codeIsNumeric: true, description: 'string'}).then(response => console.log(response.data)).catch(console.error);
using System;using System.Net.Http;using System.Text;using System.Text.Json;using System.Threading.Tasks;
public class Program{ static async Task Main() { using var client = new HttpClient(); client.DefaultRequestHeaders.Add("x-api-key", "Bearer YOUR_API_KEY");
// Create DTO object var request = new CreateBranchRequest { ProgramId = 0, Name = "string", Years = 0, CodePrefix = "string", CodeIsNumeric = true, Description = "string" };
// Serialize to JSON var json = JsonSerializer.Serialize(request); var content = new StringContent(json, Encoding.UTF8, "application/json");
// Send request var response = await client.PostAsync("https://api.unir.com/v1/api/academics/branches", content); response.EnsureSuccessStatusCode();
var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); }}
// DTO definitionpublic class CreateBranchRequest{ public int ProgramId { get; set; } public string Name { get; set; } = string.Empty; public int Years { get; set; } public string CodePrefix { get; set; } = string.Empty; public bool CodeIsNumeric { get; set; } public string Description { get; set; } = string.Empty;}
Responses
{ "id": 0, "name": "string", "description": "string"}
{ "message": "string", "errors": { "additionalProp1": [ "string" ], "additionalProp2": [ "string" ], "additionalProp3": [ "string" ] }}
Program doesn’t or no longer exist.
- Missing or invalid API KEY.
- User is not authenticated.