50

Subline API Guide

Get Subline with not found error

GET /v1/sublines/versions/123

Path Variables

Path Variable Type Optional Description

slnid

String

false

Example request

$ curl 'http://localhost:8080/v1/sublines/versions/123' -i -X GET \
    -H 'Content-Type: application/json;charset=UTF-8'

Example response

HTTP/1.1 404 Not Found
Content-Type: application/json
Content-Length: 393

{
  "status" : 404,
  "message" : "Entity not found",
  "error" : "Not found",
  "details" : [ {
    "message" : "Object with slnid 123 not found",
    "field" : "slnid",
    "displayInfo" : {
      "code" : "ERROR.ENTITY_NOT_FOUND",
      "parameters" : [ {
        "key" : "field",
        "value" : "slnid"
      }, {
        "key" : "value",
        "value" : "123"
      } ]
    }
  } ]
}

Get Subline Version Get Subline V2

GET /v2/sublines/versions/ch:1:slnid:1000019:1

Path Variables

Path Variable Type Optional Description

slnid

String

false

Example request

$ curl 'http://localhost:8080/v2/sublines/versions/ch:1:slnid:1000019:1' -i -X GET

Example response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 702

[ {
  "creationDate" : "2025-08-19T08:35:19.022637",
  "creator" : "e123456",
  "editionDate" : "2025-08-19T08:35:19.02266",
  "editor" : "e123456",
  "status" : "VALIDATED",
  "id" : 1009,
  "swissSublineNumber" : null,
  "mainlineSlnid" : "ch:1:slnid:1000019",
  "slnid" : "ch:1:slnid:1000019:1",
  "description" : "description",
  "longName" : "longName",
  "businessOrganisation" : "businessOrganisation",
  "validFrom" : "2020-01-01",
  "validTo" : "2020-12-31",
  "etagVersion" : 0,
  "sublineConcessionType" : "LINE_ABROAD",
  "sublineType" : "TECHNICAL",
  "mainSwissLineNumber" : "swissLineNumber",
  "mainLineNumber" : "number",
  "mainShortNumber" : "6",
  "mainLineOfferCategory" : "IC"
} ]

Get Subline Version Get Subline V2 Not Found

GET /v2/sublines/versions/ch:1:slnid:123

Path Variables

Path Variable Type Optional Description

slnid

String

false

Example request

$ curl 'http://localhost:8080/v2/sublines/versions/ch:1:slnid:123' -i -X GET

Example response

HTTP/1.1 404 Not Found
Content-Type: application/json
Content-Length: 415

{
  "status" : 404,
  "message" : "Entity not found",
  "error" : "Not found",
  "details" : [ {
    "message" : "Object with slnid ch:1:slnid:123 not found",
    "field" : "slnid",
    "displayInfo" : {
      "code" : "ERROR.ENTITY_NOT_FOUND",
      "parameters" : [ {
        "key" : "field",
        "value" : "slnid"
      }, {
        "key" : "value",
        "value" : "ch:1:slnid:123"
      } ]
    }
  } ]
}

Create Subline Version V2

POST /v2/sublines/versions

Request Body Fields

Path Type Optional Description

sublineType

String

false

Subline Type

Must be one of ["TECHNICAL","CONCESSION","DISPOSITION","TEMPORARY","OPERATIONAL"]

sublineConcessionType

String

true

SublineConcessionType

Must be one of ["FEDERALLY_LICENSED_OR_APPROVED_LINE","VARIANT_OF_A_LICENSED_LINE","CANTONALLY_APPROVED_LINE","RIGHT_FREE_LINE","NOT_LICENSED_UNPUBLISHED_LINE","LINE_ABROAD"]

id

Integer

true

This ID helps identify versions of a subline in the use case front end and/or update. This ID can be deleted if the version is no longer present. Do not use this ID to map your object to a subline. To do this, use the slnid in combination with the data range (valid from/valid until).

swissSublineNumber

String

true

SwissSublineNumber

Example value: b1.L1.X

Must conform to regex [-.:_0-9a-zA-Z]*

Length must be between 1 and 50

mainlineSlnid

String

false

SLNID of main line

Example value: ch:1:slnid:10001235

Length must be between 0 and 500

slnid

String

true

SLNID

Example value: ch:1:slnid:10001235:1

description

String

false

Description

Example value: Meiringen - Innertkirchen

Must conform to regex [\u0000-\u00ff]*

Length must be between 0 and 255

longName

String

true

LongName

Example value: Spiseggfräser; Talstation - Bergstation; Ersatzbus

Must conform to regex [\u0000-\u00ff]*

Length must be between 0 and 255

businessOrganisation

String

false

BusinessOrganisation SBOID

Example value: ch:1:sboid:100001

Must conform to regex [\u0000-\u00ff]*

Length must be between 1 and 50

validFrom

String

false

Valid from

validTo

String

false

Valid to

etagVersion

Integer

true

Optimistic locking version - instead of ETag HTTP Header (see RFC7232:Section 2.3)

Example value: 5

creationDate

String

true

Object creation date

Example value: 01.01.2000

creator

String

true

User creator

Example value: u123456

editionDate

String

true

Last edition date

Example value: 01.01.2000

editor

String

true

User editor

Example value: u123456

status

String

true

Status

Must be one of ["DRAFT","VALIDATED","IN_REVIEW","WITHDRAWN","REVOKED"]

Example request

$ curl 'http://localhost:8080/v2/sublines/versions' -i -X POST \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -d '{
  "creationDate" : null,
  "creator" : null,
  "editionDate" : null,
  "editor" : null,
  "status" : null,
  "id" : null,
  "swissSublineNumber" : null,
  "mainlineSlnid" : "ch:1:slnid:1000020",
  "slnid" : null,
  "description" : "b0.Ic2-sibline",
  "longName" : null,
  "businessOrganisation" : "sbb",
  "validFrom" : "2020-02-01",
  "validTo" : "2020-11-30",
  "etagVersion" : null,
  "sublineConcessionType" : null,
  "sublineType" : "TECHNICAL"
}'

Example response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 670

{
  "creationDate" : "2025-08-19T08:35:19.238092",
  "creator" : "e123456",
  "editionDate" : "2025-08-19T08:35:19.238121",
  "editor" : "e123456",
  "status" : "VALIDATED",
  "id" : 1010,
  "swissSublineNumber" : null,
  "mainlineSlnid" : "ch:1:slnid:1000020",
  "slnid" : "ch:1:slnid:1000020:1",
  "description" : "b0.Ic2-sibline",
  "longName" : null,
  "businessOrganisation" : "sbb",
  "validFrom" : "2020-02-01",
  "validTo" : "2020-11-30",
  "etagVersion" : 0,
  "sublineConcessionType" : null,
  "sublineType" : "TECHNICAL",
  "mainSwissLineNumber" : "swissLineNumber",
  "mainLineNumber" : "number",
  "mainShortNumber" : "6",
  "mainLineOfferCategory" : "IC"
}

Update Subline Version V2

PUT /v2/sublines/versions/1008

Path Variables

Path Variable Type Optional Description

id

Integer

false

Request Body Fields

Path Type Optional Description

sublineConcessionType

String

true

SublineConcessionType

Must be one of ["FEDERALLY_LICENSED_OR_APPROVED_LINE","VARIANT_OF_A_LICENSED_LINE","CANTONALLY_APPROVED_LINE","RIGHT_FREE_LINE","NOT_LICENSED_UNPUBLISHED_LINE","LINE_ABROAD"]

id

Integer

true

This ID helps identify versions of a subline in the use case front end and/or update. This ID can be deleted if the version is no longer present. Do not use this ID to map your object to a subline. To do this, use the slnid in combination with the data range (valid from/valid until).

swissSublineNumber

String

true

SwissSublineNumber

Example value: b1.L1.X

Must conform to regex [-.:_0-9a-zA-Z]*

Length must be between 1 and 50

mainlineSlnid

String

false

SLNID of main line

Example value: ch:1:slnid:10001235

Length must be between 0 and 500

slnid

String

true

SLNID

Example value: ch:1:slnid:10001235:1

description

String

false

Description

Example value: Meiringen - Innertkirchen

Must conform to regex [\u0000-\u00ff]*

Length must be between 0 and 255

longName

String

true

LongName

Example value: Spiseggfräser; Talstation - Bergstation; Ersatzbus

Must conform to regex [\u0000-\u00ff]*

Length must be between 0 and 255

businessOrganisation

String

false

BusinessOrganisation SBOID

Example value: ch:1:sboid:100001

Must conform to regex [\u0000-\u00ff]*

Length must be between 1 and 50

validFrom

String

false

Valid from

validTo

String

false

Valid to

etagVersion

Integer

true

Optimistic locking version - instead of ETag HTTP Header (see RFC7232:Section 2.3)

Example value: 5

creationDate

String

true

Object creation date

Example value: 01.01.2000

creator

String

true

User creator

Example value: u123456

editionDate

String

true

Last edition date

Example value: 01.01.2000

editor

String

true

User editor

Example value: u123456

status

String

true

Status

Must be one of ["DRAFT","VALIDATED","IN_REVIEW","WITHDRAWN","REVOKED"]

Example request

$ curl 'http://localhost:8080/v2/sublines/versions/1008' -i -X PUT \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -d '{
  "creationDate" : null,
  "creator" : null,
  "editionDate" : null,
  "editor" : null,
  "status" : null,
  "id" : 1008,
  "swissSublineNumber" : null,
  "mainlineSlnid" : "ch:1:slnid:1000018",
  "slnid" : null,
  "description" : "Kinky subline, ready to rock",
  "longName" : null,
  "businessOrganisation" : "sbb",
  "validFrom" : "2020-02-01",
  "validTo" : "2020-11-30",
  "etagVersion" : 0,
  "sublineConcessionType" : null
}'

Example response

HTTP/1.1 412 Precondition Failed
Content-Type: application/json
Content-Length: 497

{
  "status" : 412,
  "message" : "Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [SublineVersion#version]",
  "error" : "Stale object state error",
  "details" : [ {
    "message" : "Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [SublineVersion#version]",
    "field" : "etagVersion",
    "displayInfo" : {
      "code" : "COMMON.NOTIFICATION.OPTIMISTIC_LOCK_ERROR",
      "parameters" : [ ]
    }
  } ]
}