1. Overview

1.1. REST Client

Examples in this documentation use curl. The -i parameter in the examples includes the HTTP response headers. Be aware that when running Curl on MS Windows all single ' have to be replaced by double ". If Curl is not installed, an alternative is to use any REST client to explore Klass Rest interface, like Postman or address line in browser.

1.2. URL Encoding

This API requires you to use Percent-encoding for symbols and characters that are not part of the standard unreserved URI characters.

For more information on Percent-encoding see this wikipedia article

You can also see it in use in the request example for presentationNamePattern

1.3. HTTP status codes

Klass tries to adhere as closely as possible to standard HTTP and REST conventions in its use of HTTP status codes.

Status code Usage

200 OK

The request completed successfully

400 Bad Request

The request was badly formed, i.e. the client has used an invalid request. The response will include an error providing further information

404 Not Found

The requested resource did not exist. The response will include an error providing further information

1.4. Errors

Whenever an error response (status code >= 400) is returned, the response will contain an error message that describes the problem. For example, a request for a non-existent classification

$ curl 'http://data.ssb.no/api/klass/v1/classifications/99999' -i

will produce a 404 Not Found response:

HTTP/1.1 404 Not Found
Content-Type: text/plain;charset=UTF-8
Content-Length: 40

Classification not found with id = 99999

1.5. Character sets

Charset for the formats XML and JSON are UTF-8. Default charset for CSV is ISO 8859-1. This can be changed in Accept header to UTF-8.

1.6. Output formats

Default output format is XML. In many cases it is possible to get output in the supported output formats without using Curl -H (--header). Add the dot-prefix .json, .csv or .xml in the URL before the request parameters. e.g. json: http://data.ssb.no/api/klass/v1/classifications/104/codesAt.json?date=2020-01-01

1.7. Other

In PxWebApi references to a classification in Klass has the form urn:ssb:classification:klass:ID. This can be rewritten to httр://data.ssb.no/api/klass/v1/classifications/ID. For questions about Statistics Norway’s APIs use: statistikkbanken@ssb.no.

2. Classification Resources

2.1. classifications

List classifications in Klass

Supported formats

application/json, text/xml

Example request (JSON)
$ curl 'http://data.ssb.no/api/klass/v1/classifications' -i \
    -H 'Accept: application/json'
Example response (JSON)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 1272

{
  "_embedded" : {
    "classifications" : [ {
      "name" : "Standard for kommuneinndeling",
      "classificationType" : "Klassifikasjon",
      "lastModified" : "2020-03-16T08:46:31.361+0000",
      "_links" : {
        "self" : {
          "href" : "http://data.ssb.no/api/klass/v1/classifications/131"
        }
      }
    }, {
      "name" : "Standard for bydelsinndeling",
      "classificationType" : "Klassifikasjon",
      "lastModified" : "2020-03-16T08:46:31.362+0000",
      "_links" : {
        "self" : {
          "href" : "http://data.ssb.no/api/klass/v1/classifications/103"
        }
      }
    }, {
      "name" : "Standard for gruppering av familier",
      "classificationType" : "Klassifikasjon",
      "lastModified" : "2020-03-16T08:46:31.362+0000",
      "_links" : {
        "self" : {
          "href" : "http://data.ssb.no/api/klass/v1/classifications/17"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications"
    },
    "search" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/search{?query,includeCodelists}",
      "templated" : true
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 3,
    "totalPages" : 1,
    "number" : 0
  }
}
Response structure
Path Type Description

_embedded.classifications

Array

An array of Classifications

_embedded.classifications[].name

String

Classification name

_embedded.classifications[].lastModified

String

Last modification time of classification

_embedded.classifications[]._links

Object

Link to classification

_links

Object

Links to other resources

page

Object

Describes number of classifications returned, see page

Relation Description

self

The current request

search

Link to search for classifications

Request parameters
Parameter Description

includeCodelists

[Optional] include ssb codelists. Default is false.

changedSince

[Optional] specifies that only classifications that have been changed since changedSince shall be included in the response. For details see changedSince

Search for classifications in Klass

Supported formats

application/json, text/xml

Example request (JSON)
$ curl 'http://data.ssb.no/api/klass/v1/classifications/search?query=kommuner' -i \
    -H 'Accept: application/json'
Example response (JSON)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 568

{
  "_embedded" : {
    "searchResults" : [ {
      "name" : "Standard for kommuneinndeling",
      "snippet" : "Kommuneinndelingen er en administrativ inndeling av Norge",
      "searchScore" : 8.0,
      "_links" : {
        "self" : {
          "href" : "http://data.ssb.no/api/klass/v1/classifications/131"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/search?query=kommuner"
    }
  },
  "page" : {
    "size" : 0,
    "totalElements" : 1,
    "totalPages" : 1,
    "number" : 0
  }
}
Response structure
Path Type Description

_embedded.searchResults

Array

An array of search results

_embedded.searchResults[].snippet

String

A line containing match for the words searched

_embedded.searchResults[].searchScore

Number

Represents this classifications relevans for the search

_embedded.searchResults[]._links

Object

Link to classification that matched search

_links

Object

Links to other resources

page

Object

Describes number of classifications returned, see page

Relation Description

self

The current search

Request parameters
Parameter Description

query

[Mandatory] specifies search terms

includeCodelists

[Optional] include ssb codelists. Default is false.

ssbSection

[Optional] only include classifications belonging to specified SSB section when searching classifications. Default is all SSB sections

2.3. classifications by ID

Get details of a classification. To get codes from the classification use operations specified in Links

Supported formats

application/json, text/xml

Example request (JSON)
$ curl 'http://data.ssb.no/api/klass/v1/classifications/131' -i \
    -H 'Accept: application/json'
Example response (JSON)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 2639

{
  "name" : "Standard for kommuneinndeling",
  "classificationType" : "Klassifikasjon",
  "lastModified" : "2020-03-16T08:46:30.817+0000",
  "description" : "Kommuneinndelingen er en administrativ inndeling av kommuner i Norge",
  "primaryLanguage" : "nb",
  "copyrighted" : false,
  "includeShortName" : false,
  "includeNotes" : false,
  "contactPerson" : {
    "name" : "Ziggy Stardust",
    "email" : null,
    "phone" : null
  },
  "owningSection" : "section",
  "statisticalUnits" : [ ],
  "versions" : [ {
    "name" : "Kommuneinndeling 2014",
    "validFrom" : "2014-01-01",
    "lastModified" : "2020-03-16T08:46:30.817+0000",
    "published" : [ "nb" ],
    "_links" : {
      "self" : {
        "href" : "http://data.ssb.no/api/klass/v1/versions/1"
      }
    }
  }, {
    "name" : "Kommuneinndeling 2012",
    "validFrom" : "2012-01-01",
    "validTo" : "2014-01-01",
    "lastModified" : "2020-03-16T08:46:30.818+0000",
    "published" : [ "nb" ],
    "_links" : {
      "self" : {
        "href" : "http://data.ssb.no/api/klass/v1/versions/1"
      }
    }
  } ],
  "_links" : {
    "self" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/131"
    },
    "codes" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/131/codes{?from=<yyyy-MM-dd>,to=<yyyy-MM-dd>,csvSeparator,level,selectCodes,presentationNamePattern}",
      "templated" : true
    },
    "codesAt" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/131/codesAt{?date=<yyyy-MM-dd>,csvSeparator,level,selectCodes,presentationNamePattern}",
      "templated" : true
    },
    "variant" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/131/variant{?variantName,from=<yyyy-MM-dd>,to=<yyyy-MM-dd>,csvSeparator,level,selectCodes,presentationNamePattern}",
      "templated" : true
    },
    "variantAt" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/131/variantAt{?variantName,date=<yyyy-MM-dd>,csvSeparator,level,selectCodes,presentationNamePattern}",
      "templated" : true
    },
    "corresponds" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/131/corresponds{?targetClassificationId,from=<yyyy-MM-dd>,to=<yyyy-MM-dd>,csvSeparator}",
      "templated" : true
    },
    "correspondsAt" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/131/correspondsAt{?targetClassificationId,date=<yyyy-MM-dd>,csvSeparator}",
      "templated" : true
    },
    "changes" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/131/changes{?from=<yyyy-MM-dd>,to=<yyyy-MM-dd>,csvSeparator}",
      "templated" : true
    }
  }
}
Response structure
Path Type Description

name

String

Classification name

description

String

Description of classification

primaryLanguage

String

Primary language for classification

classificationType

String

Type of classification, Classification or Codelist

copyrighted

Boolean

If true, classification is copyrighted

includeShortName

Boolean

If true, indicates that classificationItems may have shortnames

includeNotes

Boolean

If true, indicates that classificationItems may have notes

contactPerson

Object

Contact person for classification

owningSection

String

Owning SSB section

statisticalUnits

Array

Statistical units assigned to classification

lastModified

String

Last time classification has been modified

versions

Array

Array of classification versions

_links

Object

Links to operations on classification

Relation Description

self

The current request

codes

Used for getting codes from the classification, see codes

codesAt

Used for getting codes from the classification valid at a specific date, see codesAt

variant

Used for getting codes from a classification variant, see variant

variantAt

Used for getting codes from a variant of the classification valid at a specific date, see variantAt

corresponds

Used for getting mappings between two classifications, see corresponds

correspondsAt

Used for getting mappings between two classifications at a specific date, see correspondsAt

changes

Used for getting changes in codes, see changes

Request parameters
Parameter Description

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

includeFuture

[Optional] include future versions if available. Default is false.

2.4. codes

Used to get codes from a classification. A range is specified when requesting the codes, and the response will for each code indicate its valid range (validFrom/validTo). The format and character set used, can be set in the http header (setting character set is only available for csv). For more information about the range see range.
To get a snapshot of codes valid at a specified date, use codesAt

Supported formats

text/csv, application/json, text/xml

Supported character sets

ISO-8859-1 (csv only), UTF-8

Example request (CSV with UTF-8)
$ curl 'http://data.ssb.no/api/klass/v1/classifications/131/codes?from=2014-01-01&to=2015-01-01&csvSeparator=;' -i \
    -H 'Accept: text/csv; charset=ISO-8859-1'
Example response (CSV with UTF-8)
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 368

"code";"parentCode";"level";"name";"shortName";"presentationName";"validFrom";"validTo";"validFromInRequestedRange";"validToInRequestedRange"
"0101";;"1";"Halden";"";"";;;"2014-01-01";"2015-01-01"
"0104";;"1";"Moss";"";"";;;"2014-01-01";"2015-01-01"
"0105";;"1";"Sarpsborg";"";"";;;"2014-01-01";"2015-01-01"
"0106";;"1";"Fredrikstad";"";"";;;"2014-01-01";"2015-01-01"
Example response (JSON)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 980

{
  "codes" : [ {
    "code" : "0101",
    "parentCode" : null,
    "level" : "1",
    "name" : "Halden",
    "shortName" : "",
    "presentationName" : "",
    "validFromInRequestedRange" : "2014-01-01",
    "validToInRequestedRange" : "2015-01-01"
  }, {
    "code" : "0104",
    "parentCode" : null,
    "level" : "1",
    "name" : "Moss",
    "shortName" : "",
    "presentationName" : "",
    "validFromInRequestedRange" : "2014-01-01",
    "validToInRequestedRange" : "2015-01-01"
  }, {
    "code" : "0105",
    "parentCode" : null,
    "level" : "1",
    "name" : "Sarpsborg",
    "shortName" : "",
    "presentationName" : "",
    "validFromInRequestedRange" : "2014-01-01",
    "validToInRequestedRange" : "2015-01-01"
  }, {
    "code" : "0106",
    "parentCode" : null,
    "level" : "1",
    "name" : "Fredrikstad",
    "shortName" : "",
    "presentationName" : "",
    "validFromInRequestedRange" : "2014-01-01",
    "validToInRequestedRange" : "2015-01-01"
  } ]
}
Request parameters
Parameter Description

from

[Mandatory] specifies beginning of range with format <yyyy-MM-dd>. For details see range

to

[Optional] specifies end of range with format <yyyy-MM-dd>. If not set means that to is indefinite. For details see range

csvSeparator

[Optional] specifies separator to be used for csv format. For details see csvSeparator

selectCodes

[Optional] only return codes that match pattern given by selectCodes. For details see selectCodes

selectLevel

[Optional] only return codes with matching level. For details see selectLevel

presentationNamePattern

[Optional] used to build a presentationName. For details see presentationNamePattern

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

includeFuture

[Optional] include codes from the future versions if available. Default is false.

2.5. codesAt

Used to get codes from a classification. A date is specified when requesting the codes, and the response will include all codes valid at the specified date. The format and character set used, can be specified in the http header (character set is only available for csv).

Supported formats

text/csv, application/json, text/xml

Supported character sets

ISO-8859-1 (csv only), UTF-8

Example request (CSV with ISO-8859-1)
$ curl 'http://data.ssb.no/api/klass/v1/classifications/131/codesAt?date=2015-01-01' -i \
    -H 'Accept: text/csv; charset=ISO-8859-1'
Example response (CSV with ISO-8859-1)
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 202

"code","parentCode","level","name","shortName","presentationName","validFrom","validTo"
"0101",,"1","Halden","",""
"0104",,"1","Moss","",""
"0105",,"1","Sarpsborg","",""
"0106",,"1","Fredrikstad","",""
Example response (JSON)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 604

{
  "codes" : [ {
    "code" : "0101",
    "parentCode" : null,
    "level" : "1",
    "name" : "Halden",
    "shortName" : "",
    "presentationName" : ""
  }, {
    "code" : "0104",
    "parentCode" : null,
    "level" : "1",
    "name" : "Moss",
    "shortName" : "",
    "presentationName" : ""
  }, {
    "code" : "0105",
    "parentCode" : null,
    "level" : "1",
    "name" : "Sarpsborg",
    "shortName" : "",
    "presentationName" : ""
  }, {
    "code" : "0106",
    "parentCode" : null,
    "level" : "1",
    "name" : "Fredrikstad",
    "shortName" : "",
    "presentationName" : ""
  } ]
}
Request parameters
Parameter Description

date

[Mandatory] specifies codes at a certain date with format <yyyy-MM-dd>.

csvSeparator

[Optional] specifies separator to be used for csv format. For details see csvSeparator

selectCodes

[Optional] only return codes that match pattern given by selectCodes. For details see selectCodes

selectLevel

[Optional] only return codes with matching level. For details see selectLevel

presentationNamePattern

[Optional] used to build a presentationName. For details see presentationNamePattern

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

includeFuture

[Optional] include variants of the future versions if available. Default is false.

2.6. versions by ID

Used to get a classification version by ID.

Supported formats

text/csv, application/json, text/xml

Supported character sets

UTF-8, ISO-8859-1 (csv only)

Request parameters
Parameter Description

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

includeFuture

[Optional] include future versions if available. Default is false.

Example request (JSON with UTF-8)
$ curl 'http://data.ssb.no/api/klass/v1/versions/131' -i \
    -H 'Accept: application/json'
Response structure (JSON, XML)
Path Type Description

name

String

Version name

validFrom

String

Date the version is valid from

validTo

String

Date the version is valid to

lastModified

String

Time and date the version was last time modified at

published

Array

List of languages the version is published in

introduction

String

Version description

legalBase

String

Legal base

publications

String

Source references

derivedFrom

String

Derived from

correspondenceTables

Array

List of correspondence tables for the version

classificationVariants

Array

List of classification variants for the version

changelogs

Array

Log og changes

levels

Array

List of levels

classificationItems

Array

Array of classification items

_links

Object

Links to operations on the version

Response structure (JSON, XML)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 1364

{
  "name" : "Kommuneinndeling 2012",
  "validFrom" : "2012-01-01",
  "validTo" : "2014-01-01",
  "lastModified" : "2020-03-16T08:46:31.413+0000",
  "published" : [ "nb" ],
  "introduction" : "",
  "contactPerson" : {
    "name" : "Ziggy Stardust",
    "email" : null,
    "phone" : null
  },
  "owningSection" : "section",
  "legalBase" : "",
  "publications" : "",
  "derivedFrom" : "",
  "correspondenceTables" : [ ],
  "classificationVariants" : [ ],
  "changelogs" : [ ],
  "levels" : [ {
    "levelNumber" : 1,
    "levelName" : "Nivå 1"
  } ],
  "classificationItems" : [ {
    "code" : "0101",
    "parentCode" : "",
    "level" : "1",
    "name" : "Halden",
    "shortName" : null,
    "notes" : null
  }, {
    "code" : "0104",
    "parentCode" : "",
    "level" : "1",
    "name" : "Moss",
    "shortName" : null,
    "notes" : null
  }, {
    "code" : "0301",
    "parentCode" : "",
    "level" : "1",
    "name" : "Oslo",
    "shortName" : null,
    "notes" : null
  }, {
    "code" : "1739",
    "parentCode" : "",
    "level" : "1",
    "name" : "Røyrvik",
    "shortName" : null,
    "notes" : null
  }, {
    "code" : "1939",
    "parentCode" : "",
    "level" : "1",
    "name" : "Storfjord",
    "shortName" : null,
    "notes" : null
  } ],
  "_links" : {
    "self" : {
      "href" : "http://data.ssb.no/api/klass/v1/versions/1"
    }
  }
}
Example request (CSV with ISO-8859-1)
$ curl 'http://data.ssb.no/api/klass/v1/versions/131' -i \
    -H 'Accept: text/csv; charset=ISO-8859-1'
Example response (CSV with ISO-8859-1)
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 202

"code";"parentCode";"level";"name";"shortName";"notes";"validFrom";"validTo"
"0101";"";"1";"Halden";;
"0104";"";"1";"Moss";;
"0301";"";"1";"Oslo";;
"1739";"";"1";"Røyrvik";;
"1939";"";"1";"Storfjord";;

2.7. variant

Used to search codes from a classification variant. A range is specified when requesting the codes, and the response will for each code indicate its valid range (validFrom/validTo). The format and character set used, can be specified in the http header (character set is only available for csv). For more information about the range see range.
To get a snapshot of codes valid at a specified date, use variantAt. See also variants

Supported formats

text/csv, application/json, text/xml

Supported character sets

ISO-8859-1 (csv only), UTF-8

Example request (CSV with UTF-8)
$ curl 'http://data.ssb.no/api/klass/v1/classifications/84/variant?variantName=Klimagasser&from=2014-01-01&to=2015-01-01' -i \
    -H 'Accept: text/csv; charset=UTF-8'
Example response (CSV with UTF-8)
HTTP/1.1 200 OK
Content-Type: text/csv;charset=UTF-8
Content-Length: 458

"code","parentCode","level","name","shortName","presentationName","validFrom","validTo","validFromInRequestedRange","validToInRequestedRange"
"01",,"1","CO2 - karbondioksid","","",,,"2014-01-01","2015-01-01"
"02",,"1","CH4 - metan","","",,,"2014-01-01","2015-01-01"
"03",,"1","N2O - lystgass","","",,,"2014-01-01","2015-01-01"
"04",,"1","Fluorgasser","","",,,"2014-01-01","2015-01-01"
"04.1",,"2","HFK - hydrofluorkarboner","","",,,"2014-01-01","2015-01-01"
Example response (JSON)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 1254

{
  "codes" : [ {
    "code" : "01",
    "parentCode" : null,
    "level" : "1",
    "name" : "CO2 - karbondioksid",
    "shortName" : "",
    "presentationName" : "",
    "validFromInRequestedRange" : "2014-01-01",
    "validToInRequestedRange" : "2015-01-01"
  }, {
    "code" : "02",
    "parentCode" : null,
    "level" : "1",
    "name" : "CH4 - metan",
    "shortName" : "",
    "presentationName" : "",
    "validFromInRequestedRange" : "2014-01-01",
    "validToInRequestedRange" : "2015-01-01"
  }, {
    "code" : "03",
    "parentCode" : null,
    "level" : "1",
    "name" : "N2O - lystgass",
    "shortName" : "",
    "presentationName" : "",
    "validFromInRequestedRange" : "2014-01-01",
    "validToInRequestedRange" : "2015-01-01"
  }, {
    "code" : "04",
    "parentCode" : null,
    "level" : "1",
    "name" : "Fluorgasser",
    "shortName" : "",
    "presentationName" : "",
    "validFromInRequestedRange" : "2014-01-01",
    "validToInRequestedRange" : "2015-01-01"
  }, {
    "code" : "04.1",
    "parentCode" : null,
    "level" : "2",
    "name" : "HFK - hydrofluorkarboner",
    "shortName" : "",
    "presentationName" : "",
    "validFromInRequestedRange" : "2014-01-01",
    "validToInRequestedRange" : "2015-01-01"
  } ]
}
Request parameters
Parameter Description

variantName

[Mandatory] specifies name of classification variant

NOTE: If you want to look up codes from variants across multiple versions do not include the year (or year month) and do not include everything after that

Example for Particulate matter 2009 - Variant of substances emitted to air 2009 would be Particulate matter

from

[Mandatory] specifies beginning of range with format <yyyy-MM-dd>. For details see range

to

[Optional] specifies end of range with format <yyyy-MM-dd>. If not set means that to is indefinite. For details see range

csvSeparator

[Optional] specifies separator to be used for csv format. For details see csvSeparator

selectCodes

[Optional] only return codes that match pattern given by selectCodes. For details see selectCodes

selectLevel

[Optional] only return codes with matching level. For details see selectLevel

presentationNamePattern

[Optional] used to build a presentationName. For details see presentationNamePattern

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

includeFuture

[Optional] include variants of the future versions if available. Default is false.

2.8. variantAt

Used to search codes from a classification variant. A date is specified when requesting the codes, and the response will include all codes valid at the specified date. The format and character set used, can be specified in the http header (character set is only available for csv).

Supported formats

text/csv, application/json, text/xml

Supported character sets

ISO-8859-1 (csv only), UTF-8

Example request (CSV with ISO-8859-1)
$ curl 'http://data.ssb.no/api/klass/v1/classifications/84/variantAt?variantName=Klimagasser&date=2015-01-01' -i \
    -H 'Accept: text/csv; charset=ISO-8859-1'
Example response (CSV with ISO-8859-1)
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 264

"code","parentCode","level","name","shortName","presentationName","validFrom","validTo"
"01",,"1","CO2 - karbondioksid","",""
"02",,"1","CH4 - metan","",""
"03",,"1","N2O - lystgass","",""
"04",,"1","Fluorgasser","",""
"04.1",,"2","HFK - hydrofluorkarboner","",""
Example response (JSON)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 784

{
  "codes" : [ {
    "code" : "01",
    "parentCode" : null,
    "level" : "1",
    "name" : "CO2 - karbondioksid",
    "shortName" : "",
    "presentationName" : ""
  }, {
    "code" : "02",
    "parentCode" : null,
    "level" : "1",
    "name" : "CH4 - metan",
    "shortName" : "",
    "presentationName" : ""
  }, {
    "code" : "03",
    "parentCode" : null,
    "level" : "1",
    "name" : "N2O - lystgass",
    "shortName" : "",
    "presentationName" : ""
  }, {
    "code" : "04",
    "parentCode" : null,
    "level" : "1",
    "name" : "Fluorgasser",
    "shortName" : "",
    "presentationName" : ""
  }, {
    "code" : "04.1",
    "parentCode" : null,
    "level" : "2",
    "name" : "HFK - hydrofluorkarboner",
    "shortName" : "",
    "presentationName" : ""
  } ]
}
Request parameters
Parameter Description

variantName

[Mandatory] specifies name of classification variant

NOTE: If you want to look up codes from variants across multiple versions do not include the year (or year month) and do not include everything after that

Example for Particulate matter 2009 - Variant of substances emitted to air 2009 would be Particulate matter

date

[Mandatory] specifies codes at a certain date with format <yyyy-MM-dd>.

csvSeparator

[Optional] specifies separator to be used for csv format. For details see csvSeparator

selectCodes

[Optional] only return codes that match pattern given by selectCodes. For details see selectCodes

selectLevel

[Optional] only return codes with matching level. For details see selectLevel

presentationNamePattern

[Optional] used to build a presentationName. For details see presentationNamePattern

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

includeFuture

[Optional] include variants of the future versions if available. Default is false.

2.9. variants by ID

Used to get a classification variant by ID.

Supported formats

application/json, text/xml, text/csv

Supported character sets

UTF-8, ISO-8859-1 (csv only)

Request parameters
Parameter Description

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

Example request (JSON with UTF-8)
$ curl 'http://data.ssb.no/api/klass/v1/variants/1111' -i \
    -H 'Accept: application/json'
Response structure (JSON, XML)
Path Type Description

name

String

Variant name

contactPerson

Object

Contact information to the SSB section representative

owningSection

String

SSB section number

lastModified

String

Time and date the variant was last time modified at

published

Array

List of languages the version is published in

validFrom

String

Date the variant is valid from

validTo

String

Date the variant is valid to

introduction

String

Variant description

correspondenceTables

Array

List of correspondence tables for the variant

changelogs

Array

Log of changes

levels

Array

List of levels

classificationItems

Array

Array of classification items

_links

Object

Links to operations on the variant

Response structure (JSON, XML)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 1454

{
  "name" : "Variant - Tilleggsinndeling for familier 2006  - variant av Gruppering av familier 2006",
  "contactPerson" : {
    "name" : "Ziggy Stardust",
    "email" : null,
    "phone" : null
  },
  "owningSection" : "section",
  "lastModified" : "2020-03-16T08:46:31.443+0000",
  "published" : [ "nb" ],
  "validFrom" : "2006-01-01",
  "validTo" : "2030-01-01",
  "introduction" : "",
  "correspondenceTables" : [ ],
  "changelogs" : [ ],
  "levels" : [ {
    "levelNumber" : 1,
    "levelName" : "Nivå 1"
  }, {
    "levelNumber" : 2,
    "levelName" : "Nivå 2"
  } ],
  "classificationItems" : [ {
    "code" : "A",
    "parentCode" : "",
    "level" : "1",
    "name" : "Enpersonfamilie",
    "shortName" : null,
    "notes" : null
  }, {
    "code" : "A_",
    "parentCode" : "A",
    "level" : "2",
    "name" : "Enpersonfamilie",
    "shortName" : null,
    "notes" : null
  }, {
    "code" : "B",
    "parentCode" : "",
    "level" : "1",
    "name" : "Ektepar",
    "shortName" : null,
    "notes" : null
  }, {
    "code" : "BA",
    "parentCode" : "B",
    "level" : "2",
    "name" : "Ektepar med barn (yngste barn 0-17 år)",
    "shortName" : null,
    "notes" : null
  }, {
    "code" : "BB",
    "parentCode" : "B",
    "level" : "2",
    "name" : "Ektepar uten barn 0-17 år",
    "shortName" : null,
    "notes" : null
  } ],
  "_links" : {
    "self" : {
      "href" : "http://data.ssb.no/api/klass/v1/variants/1111"
    }
  }
}
Example request (CSV with ISO-8859-1)
$ curl 'http://data.ssb.no/api/klass/v1/variants/1111' -i \
    -H 'Accept: text/csv; charset=ISO-8859-1'
Example response (CSV with ISO-8859-1)
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 263

"code";"parentCode";"level";"name";"shortName";"notes";"validFrom";"validTo"
"A";"";"1";"Enpersonfamilie";;
"A_";"A";"2";"Enpersonfamilie";;
"B";"";"1";"Ektepar";;
"BA";"B";"2";"Ektepar med barn (yngste barn 0-17 år)";;
"BB";"B";"2";"Ektepar uten barn 0-17 år";;

2.10. corresponds

Used to get correspondence mappings between a source classification and a target classification. The Corresponds call works only in the direction the correspondence table has been made. A switch of source and target, returns 404 (no correspondence table). A range is specified when requesting the correspondence mappings, and the response will for each correspondence map indicate its valid range (validFrom/validTo). If a correspondence table is missing for parts of the range, the API will return 404 (not found). The format and character set used, can be specified in the http header (character set is only available for csv). For more information about the range see range.
To get a snapshot of correspondence mappings valid at a specified date, use correspondsAt

Supported formats

text/csv, application/json, text/xml

Supported character sets

ISO-8859-1 (csv only), UTF-8

Example request (CSV with UTF-8)
$ curl 'http://data.ssb.no/api/klass/v1/classifications/131/corresponds?targetClassificationId=103&from=2014-01-01&to=2015-01-01' -i \
    -H 'Accept: text/csv; charset=UTF-8'
Example response (CSV with UTF-8)
HTTP/1.1 200 OK
Content-Type: text/csv;charset=UTF-8
Content-Length: 440

"sourceCode","sourceName","sourceShortName","targetCode","targetName","targetShortName","validFrom","validTo"
"0301","Oslo","","030101","Gamle Oslo","","2014-01-01","2015-01-01"
"0301","Oslo","","030103","Sagene","","2014-01-01","2015-01-01"
"0301","Oslo","","030105","Frogner","","2014-01-01","2015-01-01"
"1201","Bergen","","120101","Arna","","2014-01-01","2015-01-01"
"1201","Bergen","","120102","Bergenhus","","2014-01-01","2015-01-01"
Request parameters
Parameter Description

targetClassificationId

[Mandatory] specifies id of target classification

from

[Mandatory] specifies beginning of range with format <yyyy-MM-dd>. For details see range

to

[Optional] specifies end of range with format <yyyy-MM-dd>. If not set means that to is indefinite. For details see range

csvSeparator

[Optional] specifies separator to be used for csv format. For details see csvSeparator

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

includeFuture

[Optional] include future versions if available. Default is false.

2.11. correspondsAt

Used to get correspondence mappings between a source classification and a target classification. CorrespondsAt works only in the direction the correspondence table has been made. A switch of source and target, returns 404 (no correspondence table). The format and character set used, can be specified in the http header (character set is only available for csv). A date is specified when requesting the correspondence mappings, and the response will include all correspondence mappings valid at the specified date.

Supported formats

text/csv, application/json, text/xml

Supported character sets

ISO-8859-1 (csv only), UTF-8

Example request (CSV with UTF-8)
$ curl 'http://data.ssb.no/api/klass/v1/classifications/131/correspondsAt?targetClassificationId=103&date=2014-01-01' -i \
    -H 'Accept: text/csv; charset=UTF-8'
Example response (CSV with UTF-8)
HTTP/1.1 200 OK
Content-Type: text/csv;charset=UTF-8
Content-Length: 288

"sourceCode","sourceName","sourceShortName","targetCode","targetName","targetShortName"
"0301","Oslo","","030101","Gamle Oslo",""
"0301","Oslo","","030103","Sagene",""
"0301","Oslo","","030105","Frogner",""
"1201","Bergen","","120101","Arna",""
"1201","Bergen","","120102","Bergenhus",""
Request parameters
Parameter Description

targetClassificationId

[Mandatory] specifies id of target classification

date

[Mandatory] specifies codes at a certain date with format <yyyy-MM-dd>.

csvSeparator

[Optional] specifies separator to be used for csv format. For details see csvSeparator

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

includeFuture

[Optional] include future versions if available. Default is false.

2.12. correspondenceTables by ID

Used to get an existent correspondence table by its ID specified in the URL. The format and character set used, must be specified in the http request header (character set is only available for csv). Correspondence table will be shown only if it exists, in the direction it has been made. Returns 404 if no correspondence table with this id. To navigate to the target or the source classification version use links specified in the JSON or XML response.

Supported formats

text/csv, application/json, text/xml

Supported character sets

ISO-8859-1 (csv only), UTF-8

Example request (CSV with ISO-8859-1)
$ curl 'http://data.ssb.no/api/klass/v1/correspondencetables/1' -i \
    -H 'Accept: text/csv; charset=ISO-8859-1'
Example response (CSV with ISO-8859-1)
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 78

"sourceCode";"sourceName";"targetCode";"targetName"
"01";"Oslo";"0301";"Oslo"
Example request (JSON with UTF-8)
$ curl 'http://data.ssb.no/api/klass/v1/correspondencetables/1' -i \
    -H 'Accept: application/json'
Response structure (JSON, XML)
Path Type Description

name

String

Correspondence table’s name

contactPerson

Object

Contact information to the SSB section representative

owningSection

String

SSB section number

source

String

Name to the source classification version

sourceId

Number

ID to the source classification version

target

String

Name to the target classification version

targetId

Number

ID to the target classification version

changeTable

Boolean

Changes done to the table

lastModified

String

Timestamp for the last modifications done to the table

published

Array

A list of the languages the correspondence table is published in

sourceLevel

Null

Level name and number for the source classification version

targetLevel

Null

Level name and number for the target classification version

description

String

Description

changelogs

Array

A list of the changes done to the correspondence table

correspondenceMaps

Array

A list of the mappings the correspondence table includes

_links

Object

links to operations on classificationFamily

Example response (JSON with UTF-8)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 985

{
  "name" : "Arbeidsgiveravgiftssoner 2012 - Kommuneinndeling 2012",
  "contactPerson" : {
    "name" : "Ziggy Stardust",
    "email" : null,
    "phone" : null
  },
  "owningSection" : "section",
  "source" : "Arbeidsgiveravgiftssoner 2012",
  "sourceId" : 2,
  "target" : "Kommuneinndeling 2012",
  "targetId" : 7,
  "changeTable" : false,
  "lastModified" : "2020-03-16T08:46:30.491+0000",
  "published" : [ "nb" ],
  "sourceLevel" : null,
  "targetLevel" : null,
  "description" : "Mapping Arbeidsgiveravgiftssoner - Kommuneinndeling",
  "changelogs" : [ ],
  "correspondenceMaps" : [ {
    "sourceCode" : "01",
    "sourceName" : "Oslo",
    "targetCode" : "0301",
    "targetName" : "Oslo"
  } ],
  "_links" : {
    "self" : {
      "href" : "http://data.ssb.no/api/klass/v1/correspondencetables/1"
    },
    "source" : {
      "href" : "http://data.ssb.no/api/klass/v1/versions/2"
    },
    "target" : {
      "href" : "http://data.ssb.no/api/klass/v1/versions/7"
    }
  }
}
Relation Description

self

The current request

source

Table’s source classification version

target

Table’s target classification version

Request parameters
Parameter Description

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

2.13. changes

List codes that have changed within a time range. The format and character set used, can be specified in the http header (character set is only available for CSV).

  • If no oldCode is present it means that newCode started to exist at time given by changeOccurred.

  • If no newCode is present it means that oldCode ceased to exist at time given by changeOccurred.

Supported formats

text/csv, application/json, text/xml

Supported character sets

ISO-8859-1 (csv only), UTF-8

Example request (CSV with ISO-8859-1)
$ curl 'http://data.ssb.no/api/klass/v1/classifications/131/changes?from=2014-01-01&to=2015-01-01' -i \
    -H 'Accept: text/csv'
Example response (CSV with ISO-8859-1)
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 87

"oldCode","oldName","oldShortName","newCode","newName","newShortName","changeOccurred"
Request parameters
Parameter Description

from

[Mandatory] specifies beginning of range with format <yyyy-MM-dd>. For details see range

to

[Optional] specifies end of range with format <yyyy-MM-dd>. If not set means that to is indefinite. For details see range

csvSeparator

[Optional] specifies separator to be used for csv format. For details see csvSeparator

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

includeFuture

[Optional] include future versions if available. Default is false.

2.14. classificationfamilies

Classification family is a grouping of classifications, used on the opening page of the Klass application.

Supported formats

application/json, text/xml

Example request (JSON)
$ curl 'http://data.ssb.no/api/klass/v1/classificationfamilies' -i \
    -H 'Accept: application/json'
Example response (JSON)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 381

{
  "_embedded" : {
    "classificationFamilies" : [ {
      "name" : "Befolkning",
      "numberOfClassifications" : 1,
      "_links" : {
        "self" : {
          "href" : "http://data.ssb.no/api/klass/v1/classificationfamilies/3"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://data.ssb.no/api/klass/v1/classificationfamilies"
    }
  }
}
Response structure
Path Type Description

_embedded.classificationFamilies

Array

An array of ClassificationFamilies

_embedded.classificationFamilies[].name

String

ClassificationFamily name

_embedded.classificationFamilies[].numberOfClassifications

Number

Number of classifications belonging to classificationFamily

_embedded.classificationFamilies[]._links

Object

Link to classificationFamily

_links

Object

Links to other resources

Relation Description

self

The current request

Request parameters
Parameter Description

ssbSection

[Optional] only include classifications belonging to specified SSB section when counting number of classifications. Default is all SSB sections

includeCodelists

[Optional] include codelists when counting number of classifications. Default is false

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

2.15. classificationfamilies by ID

Get details of a classification family, used on the opening page of the Klass application.

Supported formats

application/json, text/xml

Example request (JSON)
$ curl 'http://data.ssb.no/api/klass/v1/classificationfamilies/3' -i \
    -H 'Accept: application/json'
Example response (JSON)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 438

{
  "name" : "Befolkning",
  "classifications" : [ {
    "name" : "Standard for kommuneinndeling",
    "classificationType" : "Klassifikasjon",
    "lastModified" : "2020-03-16T08:46:31.554+0000",
    "_links" : {
      "self" : {
        "href" : "http://data.ssb.no/api/klass/v1/classifications/131"
      }
    }
  } ],
  "_links" : {
    "self" : {
      "href" : "http://data.ssb.no/api/klass/v1/classificationfamilies/3"
    }
  }
}
Response structure
Path Type Description

name

String

ClassificationFamily name

classifications

Array

Array of classifications

_links

Object

Links to operations on classificationFamily

Relation Description

self

The current request

Request parameters
Parameter Description

ssbSection

[Optional] only include classifications belonging to specified SSB section when listing classifications. Default is all SSB sections

includeCodelists

[Optional] include codelists when listing classifications. Default is false

language

[Optional] specifies language of retrieved data. Default is nb (Norwegian Bokmål). For details see language

2.16. ssbsections

List Statistics Norway divisions responsible for at least one classification.

Supported formats

application/json, text/xml

Example request (JSON)
$ curl 'http://data.ssb.no/api/klass/v1/ssbsections' -i \
    -H 'Accept: application/json'
Example response (JSON)
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 220

{
  "_embedded" : {
    "ssbSections" : [ {
      "name" : "Seksjon for primærnæringsstatistikk (420)"
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://data.ssb.no/api/klass/v1/ssbsections"
    }
  }
}
Response structure
Path Type Description

_embedded.ssbSections

Array

Array of ssb sections

_embedded.ssbSections[].name

String

Name of ssb section

_links

Object

Links to operations on ssb sections

Relation Description

self

The current request

3. Request parameters

3.1. range

A range is a time period with a from date and a to date. The dates are specified in format <yyyy-MM-dd>. from is inclusive and to is exclusive. to is optional, and if not specified the end of the range is considered to be indefinite.

When retrieving codes with a range the code may change during the range. This is indicated in the result with validFrom and validTo.

Example

A classification whose codes were updated 2014-01-01. If asking for codes for year 2013, then validFrom/validTo in response will be equal to from/to in request

$ curl 'http://data.ssb.no/api/klass/v1/classifications/131/codes?from=2013-01-01&to=2014-01-01' -i \
    -H 'Accept: text/csv'
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 364

"code","parentCode","level","name","shortName","presentationName","validFrom","validTo","validFromInRequestedRange","validToInRequestedRange"
"0101",,"1","Halden","","",,,"2013-01-01","2014-01-01"
"0104",,"1","Moss","","",,,"2013-01-01","2014-01-01"
"1739",,"1","Røyrvik","","",,,"2013-01-01","2014-01-01"
"1939",,"1","Storfjord","","",,,"2013-01-01","2014-01-01"

If now increasing the range to also include 2014, it is seen that some codes are not valid within the whole range. Some codes end at 2014 and some codes start in 2014.

$ curl 'http://data.ssb.no/api/klass/v1/classifications/131/codes?from=2013-01-01&to=2015-01-01' -i \
    -H 'Accept: text/csv'
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 510

"code","parentCode","level","name","shortName","presentationName","validFrom","validTo","validFromInRequestedRange","validToInRequestedRange"
"0101",,"1","Halden","","",,,"2013-01-01","2015-01-01"
"0104",,"1","Moss","","",,,"2013-01-01","2015-01-01"
"1739",,"1","Raarvihke Røyrvik","","",,,"2014-01-01","2015-01-01"
"1739",,"1","Røyrvik","","",,,"2013-01-01","2014-01-01"
"1939",,"1","Omasvuotna Storfjord Omasvuonon","","",,,"2014-01-01","2015-01-01"
"1939",,"1","Storfjord","","",,,"2013-01-01","2014-01-01"

3.2. changedSince

changedSince is used to find classifications that have been updated since a specified time. changedSince is specified in ISO 8601 DateTime format <yyyy-MM-dd’T’HH:mm:ss.SSSZ> e.g. "2015-10-31T01:30:00.000-0200"

Example
$ curl 'http://data.ssb.no/api/klass/v1/classifications?changedSince=2015-03-01T01:30:00.000-0200' -i \
    -H 'Accept: application/json'

3.3. selectCodes

selectCodes is used to limit the result to codes that match the pattern given by selectCodes.
selectCodes is a comma separated list of codes (may also use wildcard ' * ')
selectCodes can also contain ranges of codes, a range is defined using '-' between 2 codes (Wildcard '*' can also be used in range).

Codes selected

selectCodes = 3004

Only 3004

selectCodes = 3004, 3006

Only 3004 and 3006

selectCodes = 3004, 11*

3004 and all starting with 11

selectCodes = 3004-3400

range from 3004 to 3400

selectCodes = 3004-34*

range from 3004 to any higher code starting with 34

Example request for selectCodes=0301,01*;
$ curl 'http://data.ssb.no/api/klass/v1/classifications/131/codes?from=2015-01-01&to=2016-01-01&selectCodes=0301-0305,01*' -i \
    -H 'Accept: text/csv'
Example response
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 474

"code","parentCode","level","name","shortName","presentationName","validFrom","validTo","validFromInRequestedRange","validToInRequestedRange"
"0101",,"1","Halden","","",,,"2015-01-01","2016-01-01"
"0104",,"1","Moss","","",,,"2015-01-01","2016-01-01"
"0105",,"1","Sarpsborg","","",,,"2015-01-01","2016-01-01"
"0106",,"1","Fredrikstad","","",,,"2015-01-01","2016-01-01"
"0301",,"1","Oslo","","",,,"2015-01-01","2016-01-01"
"0304",,"1","Oslo","","",,,"2015-01-01","2016-01-01"

3.4. csvSeparator

csvSeparator is used to specify separator to be used for csv format. Default is ,

Example request for csvSeparator=;
$ curl 'http://data.ssb.no/api/klass/v1/classifications/131/codes?from=2014-01-01&to=2015-01-01&csvSeparator=;' -i \
    -H 'Accept: text/csv'
Example response
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 368

"code";"parentCode";"level";"name";"shortName";"presentationName";"validFrom";"validTo";"validFromInRequestedRange";"validToInRequestedRange"
"0101";;"1";"Halden";"";"";;;"2014-01-01";"2015-01-01"
"0104";;"1";"Moss";"";"";;;"2014-01-01";"2015-01-01"
"0105";;"1";"Sarpsborg";"";"";;;"2014-01-01";"2015-01-01"
"0106";;"1";"Fredrikstad";"";"";;;"2014-01-01";"2015-01-01"

3.5. language

language is used to specify which language data shall be presented in. Default if none is selected is nb (Norwegian Bokmål).

Supported languages

Language code

Language

nb

Norwegian Bokmål

nn

Norwegian Nynorsk

en

English

Example request for language=nb
$ curl 'http://data.ssb.no/api/klass/v1/classifications/131/codes?from=2015-01-01&to=2016-01-01&language=nb' -i \
    -H 'Accept: text/csv'
Example response
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 368

"code","parentCode","level","name","shortName","presentationName","validFrom","validTo","validFromInRequestedRange","validToInRequestedRange"
"0101",,"1","Halden","","",,,"2015-01-01","2016-01-01"
"0104",,"1","Moss","","",,,"2015-01-01","2016-01-01"
"0105",,"1","Sarpsborg","","",,,"2015-01-01","2016-01-01"
"0106",,"1","Fredrikstad","","",,,"2015-01-01","2016-01-01"

3.6. selectLevel

selectLevel is used to limit result to codes that are at specified level

Example request for selectLevel=1
$ curl 'http://data.ssb.no/api/klass/v1/classifications/17/codes?from=2014-01-01&to=2015-01-01&selectLevel=2' -i \
    -H 'Accept: text/csv'
Example response
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 361

"code","parentCode","level","name","shortName","presentationName","validFrom","validTo","validFromInRequestedRange","validToInRequestedRange"
"A_",,"2","Enpersonfamilie","","",,,"2014-01-01","2015-01-01"
"BA",,"2","Ektepar med barn (yngste barn 0-17 år)","","",,,"2014-01-01","2015-01-01"
"BB",,"2","Ektepar uten barn 0-17 år","","",,,"2014-01-01","2015-01-01"

3.7. presentationNamePattern

presentationNamePattern is used to build an alternative presentationName. To build a presentationName use curly braces to access other columns:

{code}
{name}
{shortName}
{lowercase(code/name/shortname)}
{uppercase(code/name/shortname)}
{capitalize(code/name/shortname)}

Examples

Given that:
code = 0101
name = Halden

presentationNamePattern presentationName

{code} - {name}

0101 - Halden

{code} - {lowercase(name)}

0101 - halden

{code} - {capitalize(name)}

0101 - Halden

{code} - {uppercase(name)}

0101 - HALDEN

{name} {code}

Halden 0101

Example request for presentationNamePattern={code}-{uppercase(name)}

(In request due to url encoding %7B = { and %7D = })

$ curl 'http://data.ssb.no/api/klass/v1/classifications/131/codes?from=2014-01-01&to=2015-01-01&presentationNamePattern=%7Bcode%7D-%7Buppercase(name)%7D' -i \
    -H 'Accept: text/csv'
Example response
HTTP/1.1 200 OK
Content-Type: text/csv;charset=ISO-8859-1
Content-Length: 418

"code","parentCode","level","name","shortName","presentationName","validFrom","validTo","validFromInRequestedRange","validToInRequestedRange"
"0101",,"1","Halden","","0101-HALDEN",,,"2014-01-01","2015-01-01"
"0104",,"1","Moss","","0104-MOSS",,,"2014-01-01","2015-01-01"
"0105",,"1","Sarpsborg","","0105-SARPSBORG",,,"2014-01-01","2015-01-01"
"0106",,"1","Fredrikstad","","0106-FREDRIKSTAD",,,"2014-01-01","2015-01-01"

3.8. ssbSection

ssbSection is used to limit result to classifications belonging to specified SSB division when searching classifications. Default is all SSB divisions.

Example request for ssbSection
$ curl 'http://data.ssb.no/api/klass/v1/classifications/search?query=kommuner&includeCodelists=true&ssbSection=370' -i \
    -H 'Accept: application/json'
Example response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 606

{
  "_embedded" : {
    "searchResults" : [ {
      "name" : "Standard for kommuneinndeling",
      "snippet" : "Kommuneinndelingen er en administrativ inndeling av Norge",
      "searchScore" : 8.0,
      "_links" : {
        "self" : {
          "href" : "http://data.ssb.no/api/klass/v1/classifications/131"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/search?query=kommuner&includeCodelists=true&ssbSection=370"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 1,
    "totalPages" : 1,
    "number" : 0
  }
}

4. Other

4.1. page

When the response contains a collection of resources (e.g. classifications or searchResults). The response will limit the returned collection to a page of configurable size. It is possible to set the size of the page in the request.

Example request
$ curl 'http://data.ssb.no/api/klass/v1/classifications?size=2' -i \
    -H 'Accept: application/json'
Example response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 1289

{
  "_embedded" : {
    "classifications" : [ {
      "name" : "Standard for kommuneinndeling",
      "classificationType" : "Klassifikasjon",
      "lastModified" : "2020-03-16T08:46:31.631+0000",
      "_links" : {
        "self" : {
          "href" : "http://data.ssb.no/api/klass/v1/classifications/131"
        }
      }
    }, {
      "name" : "Standard for bydelsinndeling",
      "classificationType" : "Klassifikasjon",
      "lastModified" : "2020-03-16T08:46:31.632+0000",
      "_links" : {
        "self" : {
          "href" : "http://data.ssb.no/api/klass/v1/classifications/103"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications?page=0&size=2"
    },
    "self" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications?size=2"
    },
    "next" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications?page=1&size=2"
    },
    "last" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications?page=1&size=2"
    },
    "search" : {
      "href" : "http://data.ssb.no/api/klass/v1/classifications/search{?query,includeCodelists}",
      "templated" : true
    }
  },
  "page" : {
    "size" : 2,
    "totalElements" : 3,
    "totalPages" : 2,
    "number" : 0
  }
}
Response structure
Path Type Description

page.size

Number

Size of a page (number of elements per page)

page.totalElements

Number

Total number of elements in collection

page.totalPages

Number

Total number of pages

page.number

Number

Page number

Relation Description

self

The current request

search

Search

first

First page

next

Next page

last

Last page