This repo contains Sanity Studio and Schemas (content models) for Bygg21 API.
The API is public and no authentication is needed.
Our API contains simplified and structured information from the two best practise processes for how to develop a regulation plan and for how to carry out a building process:
- Gjennomføring av bygg- og anleggsprosjekter: Neste steg
- Steg for steg - veien til raskere reguleringsplan
Our thought is that this data might be useful to include in project managment tools for the building industry, but you may use it however you like.
Our API is created using Sanity, which exposes a traditional HTTP based REST API.
We have a single endpoint for all data, but use a query language called GROQ to give us what we want. The query language is quite simmilar to GraphQL, but with more features.
Endpoint:
https://q2a6l50y.api.sanity.io/v1/data/query/metier
Get all data about "Neste steg":
https://q2a6l50y.api.sanity.io/v1/data/query/metier?query=*[_type=="nextStep"]
Get all data about "Neste steg", but limit to Step info (number, title and description):
https://q2a6l50y.api.sanity.io/v1/data/query/metier?query=*[_type=="nextStep"]{steps[]{details{number,title,description}}}
Get all data about "Steg for steg":
https://q2a6l50y.api.sanity.io/v1/data/query/metier?query=*[_type=="stepByStep"]
Get all data about "Steg for steg", but limit to Step info (number, title and description):
https://q2a6l50y.api.sanity.io/v1/data/query/metier?query=*[_type=="stepByStep"]{steps[]{details{number,title,description}}}
Or you can get an export of all data and use as you want:
https://q2a6l50y.api.sanity.io/v1/data/export/metier
More about Sanitys HTTP API:
https://www.sanity.io/docs/http-api/http-urls
How to write GRQO queries:
https://www.sanity.io/docs/data-store/how-queries-work
A handy "Query cheat sheet":
https://www.sanity.io/docs/data-store/query-cheat-sheet
Most of the data and structure should be self-describing, but a few might need an extra explanation.
documentMeta
(object)
This contains information about the document. lastChanged
(date) and version
(number) should be updated if the structure changes or on a larger text update. Minor text changes will not change this, but be reflected in Sanitys built-in _updatedAt
.
deliveryFail
(boolean)
This means that the project should return to step 1 if the delivery fails. This is only relevant for "Neste steg / Next step".
meetings
(array)
If a step should end with a meeting (for example "Oppstartsmøte"), this array should have one item. The structure of a meeting is similar to a step. This is only relevant for "Steg for steg / Step by step".
If you need to make changes to the Schema (content model), this can be done locally:
- Install Sanity:
npm install -g @sanity/cli
- Clone this repo
- Install dependencies:
npm i
- Run Sanity studio:
sanity start
Important!
Remember to deploy changes to Studio after making changes to schemas: Run sanity deploy
. This will probably be automatic in the future (CI).
Also important!
Remember that even though you work locally, changes made to the content in Studio will be globally. If you need to experiment with the data, download and work on a copy of the dataset: https://www.sanity.io/docs/data-store/migrating-data
Manage content:
https://bygg21-api.sanity.studio
Manage users:
https://manage.sanity.io/
Project ID:
q2a6l50y