Errors
An error is a JSON document in the format of RFC 9457, with the content type application/problem+json:
{
"type": "https://api.sedis.se/problems/validation",
"title": "The upload has errors.",
"status": 422,
"detail": "2 errors. Nothing was saved.",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"errors": [
{
"pointer": "#/rows/0/sedisId",
"code": "unknownSedisId",
"detail": "No property unit with sedisId 'OKAND123' exists for this customer."
},
{
"pointer": "#/rows/1/values/EB0",
"code": "missingRequiredValue",
"detail": "EB0 is required to submit."
}
]
}
Let your program look at status, type and code. They are part of the contract. title and detail are for people and may be reworded. traceId finds the call in our logs: send it along when you write to us.
Status codes
| Status | What it means | What to do |
|---|---|---|
400 |
The call could not be understood: an unknown field or sort order, a quarter that is not a quarter, broken JSON, or no Idempotency-Key |
Correct the call. invalidFields or errors says what is wrong. |
401 |
No key or token, or one that does not work any longer | Check the header. A person signs in again. |
403 |
Not allowed: the key or sign-in does not include the product, or a person tries to write | Ask for access, or use an organisation key |
404 |
Does not exist, or is not yours. The API does not say which. | Check the id. Upper and lower case matter in a sedisId. |
409 |
Something is in the way: the name is taken, the date is already submitted, the values are shared, or the same call is still running | Read detail, which says how to go on |
412 |
Somebody has changed the property unit since you read it | Read it again and redo your change |
413 |
The upload is over 5 MB | Split it |
415 |
Wrong content type. PATCH needs application/merge-patch+json. |
Correct the header |
422 |
Understood, but it breaks a rule. Nothing was saved. | Correct everything in errors and send it again |
429 |
Too many calls | Wait for as many seconds as Retry-After says |
500 |
Something broke on our side | Try again in a while. If it goes on, send us the traceId. |
Try again by yourself only on 429, on 500 and when the network fails. Wait longer each time.
Problem types
type |
Status | What it means |
|---|---|---|
https://api.sedis.se/problems/validation |
422 | One or more rules are broken. All of them are in errors. |
https://api.sedis.se/problems/conflict |
409 | Something that exists is in the way. existingSedisId or existingUploadId says what. |
https://api.sedis.se/problems/precondition-failed |
412 | If-Match names an older version |
https://api.sedis.se/problems/idempotency-key-reused |
422 | The Idempotency-Key has been used for another call. Use a new one. |
https://api.sedis.se/problems/shared-data |
409 | The values are shared and cannot be removed. They can be corrected with PATCH. |
Other errors have the type of their status code.
Error codes
These are the codes in the errors list of a 422. pointer shows the place in what you sent: #/rows/3/values/EB0 is EB0 in the fourth row.
code |
What is wrong |
|---|---|
nameRequired |
The property unit has no name |
invalidValue |
The value cannot be used: too long, of the wrong type, or an id that does not exist. detail says which. |
missingRequiredValue |
Something is missing: municipalityId with a Swedish designation, or EA0 or EB0 when you submit |
geometryOutOfRange |
The point is outside the coordinate system. The coordinates are usually in the wrong order. |
geometryOutsideMunicipality |
The point is not in the municipality |
geometryOutsideCountry |
The point is not in the country |
unknownSedisId |
You have no property unit with that sedisId |
nameNotFound |
You have no property unit with that name. Create it first. |
ambiguousName |
Several of your property units have that name. Use sedisId. |
sedisIdNameMismatch |
sedisId and name point at different property units |
duplicateProperty |
The same property unit is on two rows |
unknownParameterCode |
There is no such parameter. Upper and lower case matter. |
notBaseParameter |
The parameter is calculated by Sedis and cannot be written |
computedFromPeriods |
The yearly value is the sum of the half-years or quarters you have reported. Correct those instead. |
pendingChanges |
You have changes to these values waiting for Sedis. Submit the upload when they have been reviewed. |
changedAfterUpload |
You changed the values through the API after making the upload. Upload again, so that older values are not put back. |
New codes may be added. Treat one you do not know as an error to be read by a person.