Developers
Contents
On this page

Resources

Services

What a customer comes for — the business's menu.

A line is where someone waits; a service is what they came for. A clinic's General line may offer a consultation and a follow-up; the X-ray line a chest X-ray. Services make a menu of up to three levels, with headings that group the things a person can choose.

Fields#

A service
FieldTypeNotes
idrequiredstring
namerequiredstring
parentIdrequiredstring | null
lineIdrequiredstring
selectablerequiredboolean
activerequiredboolean
durationMinutesrequiredinteger | null
pricePaiserequiredinteger | null
  • lineId is the line a visit for this service joins.
  • parentId is the heading it sits under, or null at the top of the menu.
  • selectable is false for a heading: it groups others and cannot be chosen itself.
  • active is false when the service, a heading above it or its line is switched off. It is offered nowhere until it is on again.
  • durationMinutes is how long it usually takes, or null for the line's usual time. pricePaise is a price in paise for showing — 50000 is ₹500 — or null when the business has not given one. Line Me Up takes no payment for it.

Endpoints#

Service endpoints
EndpointScopeDoes
GET /services read The menu — every service on the lines this key may see.

The menu is read only through the API; the owner edits it in the staff app. A key limited to some lines sees the services on those lines.

Examples#

Read the menu#

Request

curl

curl "https://business.linemeup.in/api/v1/services" \
  -H "Authorization: Bearer $LINEMEUP_API_KEY"

Node

const res = await fetch("https://business.linemeup.in/api/v1/services", {
  headers: {
    Authorization: `Bearer ${process.env.LINEMEUP_API_KEY}`,
  },
});
if (!res.ok) throw new Error(`Line Me Up answered ${res.status}`);
const answer = await res.json();

Python

import os
import requests

res = requests.get(
    "https://business.linemeup.in/api/v1/services",
    headers={
        "Authorization": f"Bearer {os.environ['LINEMEUP_API_KEY']}",
    },
    timeout=10,
)
res.raise_for_status()
answer = res.json()

PHP

<?php
$ch = curl_init("https://business.linemeup.in/api/v1/services");
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("LINEMEUP_API_KEY"),
    ],
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 10,
]);
$answer = json_decode(curl_exec($ch), true);
Response (200)
{
  "data": [
    {
      "id": "svc-0193f2a1-7c4e-7a10-9b2e-000000000001",
      "name": "Consultations",
      "parentId": null,
      "lineId": "line-0193f2a1-7c4e-7a10-9b2e-000000000001",
      "selectable": false,
      "active": true,
      "durationMinutes": null,
      "pricePaise": null
    },
    {
      "id": "svc-0193f2a1-7c4e-7a10-9b2e-000000000002",
      "name": "General consultation",
      "parentId": "svc-0193f2a1-7c4e-7a10-9b2e-000000000001",
      "lineId": "line-0193f2a1-7c4e-7a10-9b2e-000000000001",
      "selectable": true,
      "active": true,
      "durationMinutes": 15,
      "pricePaise": 50000
    },
    {
      "id": "svc-0193f2a1-7c4e-7a10-9b2e-000000000003",
      "name": "Chest X-ray",
      "parentId": null,
      "lineId": "line-0193f2a1-7c4e-7a10-9b2e-000000000002",
      "selectable": true,
      "active": true,
      "durationMinutes": 20,
      "pricePaise": 120000
    }
  ]
}

Recipes#

Build the menu as a tree#

The answer is flat, parent first. Group it by parentId:

The menu, as a customer would see it

Node

const { data: services } = await get("/services");
const offered = services.filter((service) => service.active);

// Headings first, each with what may be chosen under it.
const childrenOf = (parentId) => offered.filter((service) => service.parentId === parentId);
const menu = childrenOf(null).map((top) => ({
  ...top,
  children: childrenOf(top.id),
}));

// What a customer may pick: active and selectable.
const choosable = offered.filter((service) => service.selectable);

Python

services = get("/services")["data"]
offered = [s for s in services if s["active"]]

def children_of(parent_id):
    return [s for s in offered if s["parentId"] == parent_id]

menu = [{**top, "children": children_of(top["id"])} for top in children_of(None)]

choosable = [s for s in offered if s["selectable"]]

PHP

<?php
$services = get('/services')['data'];
$offered = array_values(array_filter($services, fn ($s) => $s['active']));

$childrenOf = fn ($parentId) =>
    array_values(array_filter($offered, fn ($s) => $s['parentId'] === $parentId));
$menu = array_map(
    fn ($top) => $top + ['children' => $childrenOf($top['id'])],
    $childrenOf(null),
);

$choosable = array_values(array_filter($offered, fn ($s) => $s['selectable']));

Add a visit for what someone came for#

Instead of a line, POST /v1/visits takes the services chosen, and puts the person on the line of each. Services on two lines make two visits sharing one journeyId — see Visits.

The body, by services (ids shortened)
{
  "serviceIds": ["svc-…consultation", "svc-…chest-x-ray"],
  "customer": { "name": "Asha Rao", "phone": "+919000000001" }
}