:
Last modified: Oct 17, 2022

Storage

The Storage component gives storage capabilities to the apps.

Storage support storage of structured and unstructured data for apps. Apps that need the cabability to store data uses the storage service in the Altinn platform to store both metadata and actual data.

Metadata

Stored in Azure Cosmos Db.

Formdata and attachments

Stored in Azure Blob Storage. One storage account for each application owner.

Additional details

{
    "id": "test/sailor",
    "versionId": "v32.23-xyp",
    "org": "test",
    "app": "sailor",
    "created": "2019-03-06T13:46:48.6882148+01:00",
    "createdBy": "XXX",
    "title": { "nb": "Testapplikasjon", "en": "Test Application" },
    "processId": "standard",
    "validFrom": "2019-04-01T12:14:22+01:00",
    "validTo": null,
    "maxSize": null,
    "dataTypes": [
        {
            "id": "boatdata",
            "description": {"nb": "Båtdata", "en": "Boat data"},
            "allowedContentTypes": ["application/json"],
            "taskId": "Task_1",
            "appLogic": {
                "autoCreate": true,
                "classRef": "Skjema",
                "schemaRef": "schemas/boatname"
            },
            "maxSize": 200000,
            "maxCount": 1
        },
        {
            "id": "crewlist",
            "allowedContentTypes": ["application/xml"],
            "taskId": "Task_2",
            "appLogic": {
                "autoCreate": false,
                "classRef": "CrewList",
                "schemaRef": "schemas/crewlist"
            },
            "maxSize": null,
            "minCount": 1,
            "maxCount": 3
        },
        {
            "id": "certificate",
            "allowedContentType": ["application/pdf"],
            "appLogic": null,
            "maxSize": null,
            "maxCount": 1
        }
    ]
}

Application type

PropertyTypeDescription
idstringapplication id
versionIdstringrelease or commit id
processIdstringapplication process id
titleLanguageString[]application title in different languages
validFromdateTimewhen the application is valid from
validTodateTime?when the application is valid to
dataTypesDataType[]Metadata about data requirements in the application. See DataType.
maxSizeintegerthe maximum number of bytes that the data elements can have

DataType

The DataType model represents data requirements for an application for different process tasks.

PropertyTypeDescription
idstringRequired. Id of the data type.
descriptionLanguageString[]A short description of the data type. Language support.
allowedContentTypesstring[]A list of allowed content types.
allowedContributersstring[]A list of allowed contributers. On the format ‘{keyword}:{value}’ Approved keywords are: org and orgno.
taskIdstringRequired. Associated task from the process definition. Defines that the data is required to progress to next task in a process.
appLogicApplicationLogicData object that connect data to application models. This should be null for data types describing attachments. See ApplicationLogic.
maxSizeintMaximum allowed size of a data item of this type. Undefined means that the limit is unbounded.
maxCountintMaximum allowed data item count of this type. Zero or below indicate unbounded.
minCountintMinimum number of data items of this type. Zero or below indicate that the data type is optional.

Example

{
    "id": "receipt",
    "allowedContentTypes": ["image/jpeg", "image/png"],
    "taskId": "Task_1",
    "appLogic": null,
    "maxSize": 20,
    "minCount": 1,
    "maxCount": 3
}

In order to complete process task Task_1 the user must upload at least one image. It can be either a jpg or png below 20 MB. The user is allowed to upload additional 2 images. The application does not have any business logic associated with the data type.

ApplicationLogic

The ApplicationLogic model describes the connection between a data type and a corresponding data model in the application. This is required for all data types associated with an XSD or JSON Schema. In most cases it also implies that there is a UI with a form the user can fill in.

PropertyTypeDescription
autoCreateboolIndicate that the application should automatically create a data item of this type with every new application instance.
classRefstringReference to the class definition representing the data model.
schemaRefstringReference to the XSD or JSON schema.

Operations

Get a list of all Applications

GET /applications

Get metadata about a specific application

GET /applications/{appId}

Get application events.

GET /applications/{appId}/events

InstanceEvent

User actions on an instance trigger instance events such as created, saved, _submitted, deleted, and undeleted. The events are associated with an instance, a user and an instance owner and generated by the application and stored in CosmosDB.

Format of the JSON object stored in the database.

{
    "id":"6dff32bc-0928-4ae8-937c-b362d6941c89",
    "instanceId": "60238/5c6b1a71-2e1f-447a-ae2f-d1807dcffbfb",
    "eventType": "deleted",
    "created": "2019-05-02T13:08:21.981476Z",
    "instanceOwnerPartyId": "60238",
    "user": {
        "userId": 3,
        "authenticationLevel": 1,
        "enduserSystemId": 2
    }
}

Instance Event type

AttributeTypeDescription
idGuid?Id set by CosmosDB when the instance event is stored
instanceIdstring{instanceOwnerPartyId}/{instanceGuid}
dataIdstringId of data element if event is related to a data element.
createdDateTime?DateTime set by CosmosDB when the event is stored
eventTypestringthe event type. Available instance event types are listed here
instanceOwnerPartyIdstringthe instance owner id
user.userIdint?the user who triggered the event
user.authenticationLevelintthe authentication level for the user or system that triggered the event
user.endUserSystemIdint?the end user system that triggered the event
processProcessStatethe process step during which the event occured

Operations

GET /instances/{instanceId}/events

Create an event. POST with body. Note id and createDateTime is set by the system and should not be included in the json object.

POST /instances/{instanceId}/events

Get all instance events for a specific instance.

GET /instances/{instanceId}/events

Get all instance events for a specific instance filtered by event types

GET /instances/{instanceId}/events?eventTypes={eventTypeA},{eventTypeB}

Get all instance events for a specific instance within a time frame The times are strings defined in UTC-format. E.g. “2019-05-03T12:55:23”

GET /instances/{instanceId}/events?from={fromtime}&to={totime}

Get all instance events for a specific instance within a time frame filtered by event types

GET /instances/{instanceId}/events?from={fromtime}&to={totime}&eventTypes={eventTypeA},{eventTypeB}

Delete all instance events for a specific instance. DELETE request.

DELETE /instances/{instanceId}/events

MessageBoxInstance

A message box instance is a compressed instance object stripped for data that is not relevant for the Altinn II message box. In addition some properties from the application metadata such as application title are included in the object.

MessageBoxInstance type

AttributeTypeDescription
idstringunique id (corrresponds to instance guid)
instanceOwnerIdintegerid of instance owner
orgstringApplication owner for the app
appNamestringname of the application
titlestringtitle of the application in language defined in the request
processCurrentTaskstringcurrent task in the process state
createDateTimedateTimecreation time
lastChangedBystringuser id of the user who last changed the instance
lastChangedBystringuser id
dueDateTimedateTime?deadline for submit
boolallowDeleteis current user allowed to delete instance
boolauthorizedForWriteis current user allowed to write to edit the instance
deletedDateTimedateTime?date the instance was deleted
archivedDateTimedateTime?date the instance was archived

Operations

Get a single instance in message box instance format in (optional) preffered language. Default lanugage is norsk bokmål (nb). Available language specifications: en, nb, nn-NO.

GET /sbl/instances/{instanceOwnerPartyId}/{instanceId}?language={languageId}

Get list of all instances for an instance owner in a specific state, with a visible dateTime that has passed and (optional) preffered language. Available states: active, deleted, archived. Available language specifications: en, nb, nn-NO.

GET /sbl/instances/{instanceOwnerPartyId}?state={instanceState}&language={languageId}

Search instances based on query parameters All query parameters are optional.

GET /sbl/instances/search?instanceOwner.partyId={instanceOwnerPartyId}&language={languageId}&appId={applicationId}

Mark an instance for deletion in storage. Set parameter hard equal to true or false to indicate soft or hard deletion. Calling this endpoint will not the delete the instance from Storage, simply mark is as deleted.

DELETE /sbl/instances/{instanceOwnerPartyId}/{instanceId}?hard={true/false}

Restore a soft deleted instance.

PUT /sbl/instances/{instanceOwnerPartyId}/{instanceId}/undelete

ProcessHistory

The process history is a list comprised of process history events for a given instance.

ProcessHistoryItem type

AttributeTypeDescription
EventTypestringthe event type. Available process event types are listed here with the prefix process_
ElementIdstringelement id for the process flow step
OccuredDateTime?event occurence time
StartedDateTime?task start time
EndedDateTime?task end time

Operations

Get process history for a given instance

GET /instances/{instanceOwnerPartyId}/{instanceId}/process/history

Texts

Represents text resources for an application.

Text type

PropertyTypeDescription
idstringtext id {org-app-language}. Only used internally for storage purposes. Auto generated.
languagestringthe language. Two letter ISO name.
orgstringthe org. Only used internally for storage purposes. Auto generated.
resourcesTextResource[]list of text resources

The id and org fields are generated by the system, and should not be included when using POST the text resource object. Example of an text element that should be sent during a POST:

{
    "language": "nb",
    "resources:": [
        {"id": "some_id", "value": "some value"},
        {"id": "some_other_id", "value": "some other value"},
        {"id": "yet_another_id", "value": "Text containing two variables: {0} and {1}.",
         "variables":[
            {
            "key": "dataSouce.TextKey_1",
            "dataSource": "dataModel.dataModelName"
            },
            {
            "key": "dataSouce.TextKey_2",
            "dataSource": "dataModel.dataModelName"
            }]
        }
    ]
}

TextResource type

PropertyTypeDescription
idstringtext resource id (for instance schema.postplace)
valuestringthe value
variableslist<TextResourceVariable>list of text resource variables.

TextResourceVariable type

PropertyTypeDescription
keystringthe key for the text resource variable
dataSourcestringthe datasource for the text resource variable. Allowed prefix: “dataModel”

Operations

Create a new text resource for an application.

POST /applications/{appId}/texts

Get a specific text resource for an application.

GET /applications/{appId}/texts/{language}

Update a specific text resource for an application.

PUT /applications/{appId}/texts/{language}

Delete a specific text resource for an application.

DELETE /applications/{appId}/texts/{language}