Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Assign by rule

    Apply a rule such as assigning onboarding when HR adds someone to the New hires group.

    Evaluate the rule in your integration

    Resolve the group and course IDs. List current assignments for the learners and course before sending the group write. A current assignment for any member causes the entire batch to be refused. Use a group containing only eligible learners for another batch. For the New hires rule, set dueOn to 12 calendar days after the HR sync. The path and all courses created by that write share this date. Existing course assignments keep their original dates.

    curl

    curl -X POST "$RDC_BASE_URL/elearning/v1/assignments" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "4e08713a-ec34-4a5a-92d3-81fd425640ad",
      "expectedRevision": 0,
      "groupId": "logistics",
      "courseId": "receiving-goods",
      "dueOn": "2026-12-05",
      "mandatory": true
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/elearning/v1/assignments`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "4e08713a-ec34-4a5a-92d3-81fd425640ad",
        "expectedRevision": 0,
        "groupId": "logistics",
        "courseId": "receiving-goods",
        "dueOn": "2026-12-05",
        "mandatory": true
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/elearning/v1/assignments',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '4e08713a-ec34-4a5a-92d3-81fd425640ad',
            'expectedRevision': 0,
            'groupId': 'logistics',
            'courseId': 'receiving-goods',
            'dueOn': '2026-12-05',
            'mandatory': True,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "4e08713a-ec34-4a5a-92d3-81fd425640ad",
      "expectedRevision": 0,
      "groupId": "logistics",
      "courseId": "receiving-goods",
      "dueOn": "2026-12-05",
      "mandatory": true
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/elearning/v1/assignments');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => $body,
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/elearning/v1/assignments");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "4e08713a-ec34-4a5a-92d3-81fd425640ad",
      "expectedRevision": 0,
      "groupId": "logistics",
      "courseId": "receiving-goods",
      "dueOn": "2026-12-05",
      "mandatory": true
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "4e08713a-ec34-4a5a-92d3-81fd425640ad",
      "status": "accepted",
      "aggregateRevision": null
    }

    Store the operation UUID against the rule run. After it completes, read the assignments to get the separate ID of each learner’s record. Assigning a path also assigns each of its courses that the learner does not already hold, so expect a record for the path and one for each of those courses.