RUFUS Help
RUFUS Cloud Public API
RUFUS Cloud Public API
  • Introduction to RUFUS Cloud API
  • Getting Started
    • Overview
    • Get your api keys
    • Api permissions
  • TIMING DEVICES
    • Overview
    • Bind a new device
    • Unbind a device
    • Get devices by company
    • Get device information
  • TIMING SESSIONS
    • Overview
    • Insert a new session
    • Close a session
    • Get sessions by device
    • Get active session from device
    • Get session information
  • RACE PASSINGS
    • Overview
    • Insert passings
    • Get session passings by range
    • Get device passings by datetime
Powered by GitBook
On this page
  1. TIMING SESSIONS

Insert a new session

Insert a new timing session into a device.

Returns the token_session identification token for the new inserted session. This token_session must be stored in the device in order to then authenticate and send passings.

New timing sessions are always active by default. If there's any other active session it will be closed.

Inserts a new and active timing session in the given device and returns the token_session.

POST https://api.runonrufus.com/v0/sessions

Headers

Name
Type
Description

api_key*

String

Account api key with WRITE or READ_WRITE access type.

Request Body

Name
Type
Description

deviceid*

String

Deviceid where to insert the new session.

alias

String

A name for the new session.

{
    "description":"Session inserted succesfully"
    "token_session":"2A19294BB886C3D5C7783309BBC6E385515C843893A6BC126FECE3904C6E2B25"
}

{
    description: "Device not found",
    deviceid: "65A1B7E0C6BC3D32C268C1506E3F6F39E225DC6ED79573E177E7243E8E38115B",
}
curl -X POST \
-H "Content-Type: application/json" \
-H "api_key: ror-ae4fc6c19681a20fad30" \
-d '{"deviceid": "65A1B7E0C6BC3D32C268C1506E3F6F39E225DC6ED79573E177E7243E8E38115B", "alias": "START-5K"}' \
https://api.runonrufus.com/v0/sessions
<?php
$url = "https://api.runonrufus.com/v0/sessions";

$data = array('deviceid' => '65A1B7E0C6BC3D32C268C1506E3F6F39E225DC6ED79573E177E7243E8E38115B', 'alias' => 'START-5K');

$options = array(
    'http' => array(
      'method'  => 'POST',
      'content' => json_encode($data),
      'header'=>  "Content-Type: application/json\r\n" .
                  "api_key: ror-ae4fc6c19681a20fad30\r\n" .
                  "Accept: application/json\r\n"
      )
  );
  
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$response = json_decode($result);
var_dump($response);
?>
fetch("https://api.runonrufus.com/v0/sessions", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "api_key": "ror-ae4fc6c19681a20fad30",
    },
    body: JSON.stringify({"deviceid": "65A1B7E0C6BC3D32C268C1506E3F6F39E225DC6ED79573E177E7243E8E38115B", "alias": "START-5K"),
  })
    .then((response) => console.log(response))
    .catch((error) => console.error(error));
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace HttpClientExample
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var data = new
            {
                deviceid = "65A1B7E0C6BC3D32C268C1506E3F6F39E225DC6ED79573E177E7243E8E38115B",
                alias = "START-5K",
            };

            using var client = new HttpClient();

            client.DefaultRequestHeaders.Add("Content-Type", "application/json");
            client.DefaultRequestHeaders.Add("api_key", "ror-ae4fc6c19681a20fad30");

            var response = await client.PostAsync(
                "https://api.runonrufus.com/v0/sessions",
                new StringContent(
                    Newtonsoft.Json.JsonConvert.SerializeObject(data),
                    Encoding.UTF8,
                    "application/json"
                )
            );
            
            if (response.IsSuccessStatusCode)
            {
                var result = await response.Content.ReadAsStringAsync();

                Console.WriteLine(result);
            }
            else
            {
                Console.WriteLine("Error: " + response.StatusCode);
            }
        }
    }
}
PreviousOverviewNextClose a session

Last updated 2 years ago