### Start and manage Colima VM Source: https://docs.altinn.studio/nb/community/contributing/handbook/docker/without-docker-desktop/macos Commands to start the Colima virtual machine with specified resources, list running Colima instances, check the current Docker context, and configure Colima to start automatically on macOS boot. ```bash colima start --cpu 2 --memory 4 --disk 60 ``` ```bash colima ls ``` ```bash docker context ls ``` ```bash brew services restart colima ``` -------------------------------- ### System Registration Example Source: https://docs.altinn.studio/nb/api/authentication/systemuserapi/systemregister/update Example of a system object with access packages and rights. ```APIDOC ## System Registration Example ### Description This is an example of a system object that includes its vendor information, name, description, associated access packages, rights, client ID, and allowed redirect URLs. ### Method N/A (This is a data example, not an endpoint) ### Endpoint N/A ### Parameters N/A ### Request Example ```json { "id": "991825827_systemwithaccesspackageandresource", "vendor": { "authority": "iso6523-actorid-upis", "ID": "0192:991825827" }, "name": { "nb": "The Matrix", "en": "The Matrix", "nn": "The Matrix" }, "description": { "nb": "Test system", "en": "Test system", "nn": "Test system" }, "accessPackages": [ { "urn": "urn:altinn:accesspackage:skattnaering" } ], "rights": [ { "resource": [ { "id": "urn:altinn:resource", "value": "ske-krav-og-betalinger" } ] } ], "clientId": [ "32ef65ac-6e62-498d-880f-76c85c2052ae" ], "allowedredirecturls": [ "https://vg.no", "https://nrk.no", "https://altinn.no" ], "isVisible": true } ``` ### Response N/A ``` -------------------------------- ### Example System Response Model Source: https://docs.altinn.studio/nb/api/authentication/systemuserapi/systemregister/get An example JSON response model for retrieving system information, detailing fields like ID, vendor, name, description, rights, and client ID. ```json { "id": "312605031_b217b2f5-362f-4aa2-b919-ceaeaf9f15a1", "vendor": { "ID": "0192:312605031" }, "name": { "en": "Integrationb217b2f5-362f-4aa2-b919-ceaeaf9f15a1", "nb": "IntegrationTestb217b2f5-362f-4aa2-b919-ceaeaf9f15a1", "nn": "IntegrationTestNynorskb217b2f5-362f-4aa2-b919-ceaeaf9f15a1" }, "description": { "en": "This is auto generated by an integration test. Some data is randomized, but some is not - like this description", "nb": "Integrasjonstest. Noe er randomisert her, men mye blir likt.", "nn": "integrasjonstest på nynorsk. Noe er randomisert her, men mye blir likt." }, "rights": [ { "resource": [ { "id": "urn:altinn:resource", "value": "app_ttd_endring-av-navn-v2" } ] }, { "resource": [ { "id": "urn:altinn:resource", "value": "ske-krav-og-betalinger" } ] } ], "accessPackages": [], "isDeleted": true, "clientId": [ "a8be01d2-30b9-443e-98ce-4c09b0a0ad00" ], "isVisible": false, "allowedRedirectUrls": [ "https://altinn.no/" ] } ``` -------------------------------- ### Install Altinn Studio CLI using .NET CLI Source: https://docs.altinn.studio/nb/altinn-studio/v8/reference/cli/install Installs the Altinn Studio CLI globally using the .NET CLI. Ensure .NET 8.0 or later is installed. This command downloads and sets up the CLI tool for use in your terminal. ```bash dotnet tool install -g altinn.studio.cli ``` -------------------------------- ### Verify Altinn Studio CLI Installation Source: https://docs.altinn.studio/nb/altinn-studio/v8/reference/cli/install Checks if the Altinn Studio CLI has been installed correctly by displaying its version. This command confirms that the CLI is accessible and functional in your environment. ```bash altinn-studio --version ``` -------------------------------- ### Multipart Instance Instantiation Example Source: https://docs.altinn.studio/nb/altinn-studio/v8/reference/testing/local/apitests/org Example of how to instantiate application instances for actors (persons or organizations) using a POST request with multipart/form-data. Requires an Authorization header with a Bearer token and a Content-Type header specifying the boundary. ```HTTP POST http://local.altinn.cloud/ttd/mva/instances Headers: Authorization: Bearer + jwttoken Content-Type: multipart/form-data; boundary=“abcdefg” Example Body: --abcdefg Content-Type: application/json; charset=utf-8 Content-Disposition: form-data; name="instance" { "instanceOwner": { "organisationNumber" : "897069650" } } --abcdefg Content-Type: application/xml Content-Disposition: form-data; name="RF0002" DDG Fitness Sofies Gate 1 0170 By 897069650 --abcdefg-- ``` -------------------------------- ### Extract Substring with Length Source: https://docs.altinn.studio/nb/altinn-studio/v8/reference/logic/expressions The stringSlice function extracts a portion of a string. It takes the original string, a starting index, and an optional length. If the length is provided, the returned substring will have that length. This example extracts 3 characters starting from the 5th character of a full name. ```json ["stringSlice", ["dataModel", "My.Model.FullName"], 5, 3] ``` -------------------------------- ### Example k6 API Call and Response Handling Source: https://docs.altinn.studio/nb/community/contributing/handbook/test/k6 This JavaScript code snippet demonstrates how to make an HTTP GET request to a specified API endpoint with custom headers and how to handle the response. It's a foundational example for creating API interaction logic within k6 tests. ```javascript export function get(url, headers) { return http.get(url, { headers: headers, }); } ``` -------------------------------- ### Installer Altinn.FileAnalyzers NuGet-pakke Source: https://docs.altinn.studio/nb/altinn-studio/v8/reference/logic/validation/files Kommando for å installere Altinn.FileAnalyzers NuGet-pakken. Denne pakken inneholder verktøy for filanalyse og validering. ```bash nuget install Altinn.FileAnalyzers ``` -------------------------------- ### Initiate System User Request Source: https://docs.altinn.studio/nb/authorization/guides/system-vendor/system-user/systemuserrequest Initiates a request for system user creation by sending a POST request to the agent endpoint. Requires a JSON body with system details and an empty or omitted 'rights' list. ```APIDOC ## POST /agent/request ### Description Initiates a request for system user creation. The `rights` list in the request body must be empty or omitted. ### Method POST ### Endpoint - Test (TT02): `https://platform.tt02.altinn.no/authentication/api/v1/systemuser/agent/request` - Production: `https://platform.altinn.no/authentication/api/v1/systemuser/agent/request` ### Parameters #### Request Body - **systemId** (string) - Required - The ID of the system. - **partyOrgNo** (string) - Required - The organization number of the party. - **accessPackages** (array) - Required - A list of access packages to request. - **urn** (string) - Required - The URN of the access package. - **redirectUrl** (string) - Required - The URL to redirect to after approval. ### Request Example ```json { "systemId": "312605031_SuperRegnskap", "partyOrgNo": "310495670", "accessPackages": [ { "urn": "urn:altinn:accesspackage:ansvarlig-revisor" } ], "redirectUrl": "https://superregnskap.no" } ``` ### Response #### Success Response (200) - **status** (string) - The status of the request (e.g., "New"). - **confirmUrl** (string) - The URL for the end-user to confirm the request. #### Response Example ```json { "status": "New", "confirmUrl": "https://example.com/confirm-request" } ``` ``` -------------------------------- ### Consent Request Payload Example Source: https://docs.altinn.studio/nb/authorization/guides/system-vendor/consent/behalf-of This JSON payload is an example of a consent request sent to Altinn. It includes a unique ID for the consent, the 'from' and 'to' parties (person/org to get consent from and the organization receiving consent), the validity period, details about the consent rights including resource and metadata, and a redirect URL for the end-user. ```json { "id": "a005e4e7-78b3-42b4-ce69-dc68cc5349eb", // Unik samtykke-UUID (generer ny per forespørsel) "from": "urn:altinn:person:identifier-no:03867199348", // Person eller org det skal hentes samtykke fra "to": "urn:altinn:organization:identifier-no:313876144", // Sparebank Super "validTo": "2026-07-07T13:45:00.0000000+00:00", // Varighet på samtykket (tidspunkt samtykket utløper) "consentRights": [ { "action": ["consent"], "resource": [ { "type": "urn:altinn:resource", "value": "enkelt-samtykke" // Referanse til ressurs i ressursregisteret (se https://docs.altinn.studio/nb/api/resourceregistry/resource/) } ], "metaData": { // Metadata-tags definert på ressursen i ressursregisteret "simpletag": "2026" } } ], "redirectUrl": "https://altinn.no" // Hvor sluttbruker sendes etter godkjenning/avslag } ``` -------------------------------- ### Example Flow: Instance Data Processing Source: https://docs.altinn.studio/nb/events/subscribe-to-events/developer-guides/process-app-events A step-by-step guide on processing instance data, from setting up event subscriptions to fetching metadata and completing the instance. ```APIDOC ## Eksempelflyt: instansdataprosessering 1. **Set up a subscription** for an application resource and relevant event type(s) for you, e.g., `app.instance.created` or `app.instance.process.completed`. 2. **When an event is pushed** to your endpoint, follow the source link to access the application instance's metadata. Note that the client must authenticate itself against this endpoint as well. ### Event Payload Example ```json { "id": "b4d1d548-1280-464c-a8da-dee9840909de", "time": "2023-04-18T12:16:38.7942271Z", "type": "app.instance.process.completed", "source": "https://ttd.apps.at22.altinn.cloud/ttd/apps-test/instances/50019855/6b3323c8-7baf-4612-b8a6-5eac407f4d0c", "subject": "/party/50019855", "specversion": "1.0", "alternativesubject": "/person/16035001577" } ``` 3. **Instance metadata** will provide a list of data elements related to the instance containing download links. Use either the `apps` or `platform` self-links to download the data using the same credentials as for the previous request. ### Instance Metadata and Data Links Example ```json "data": [ { "id": "abbccf62-0c8b-4acd-a99c-57e45d7542bc", "instanceGuid": "6b3323c8-7baf-4612-b8a6-5eac407f4d0c", "dataType": "default", "filename": null, "contentType": "application/xml", "blobStoragePath": "ttd/apps-test/6b3323c8-7baf-4612-b8a6-5eac407f4d0c/data/abbccf62-0c8b-4acd-a99c-57e45d7542bc", "selfLinks": { "apps": "https://ttd.apps.at22.altinn.cloud/ttd/apps-test/instances/50019855/6b3323c8-7baf-4612-b8a6-5eac407f4d0c/data/abbccf62-0c8b-4acd-a99c-57e45d7542bc", "platform": "https://platform.at22.altinn.cloud/storage/api/v1/instances/50019855/6b3323c8-7baf-4612-b8a6-5eac407f4d0c/data/abbccf62-0c8b-4acd-a99c-57e45d7542bc" }, "size": 541, "locked": false, "refs": [], "isRead": true, "tags": [], "deleteStatus": null, "created": "2023-04-18T12:16:38.5517968Z", "createdBy": "20003904", "lastChanged": "2023-04-18T12:16:38.5517968Z", "lastChangedBy": "20003904" } ] ``` 4. **If you are the application owner** and this is part of processing a submitted instance, complete this flow by calling the complete confirm endpoint for the instance. This informs Altinn that you, as the application owner, have downloaded everything you need, meaning Altinn does not need to maintain the instance and related schema data and attachments after the end-user deletes it from their message box. ``` -------------------------------- ### Fetch Data from Application A using C# Source: https://docs.altinn.studio/nb/altinn-studio/v8/guides/development/multi-app-solution/instructions/app-b This C# code snippet demonstrates how to actively fetch data from Application A using the `ProcessDataRead` method in the `DataProcessor` service and the `UpdateData` method on the `dataClient`. It's used when presentation fields or prefill options are insufficient. ```csharp public async Task ProcessDataRead(Instance instance, Guid? dataId, object data) { bool redigert = false; if (data.GetType() == typeof(DataModel)) { DataModel modell = (DataModel)data; DataElement data = instance.Data.FirstOrDefault(de => de.DataType == [DATA_TYPE]); if (data != null) { var instansGuid = Guid.Parse(instance.Id.Split("/")[1]); await _dataClient.UpdateData(modell, instansGuid, typeof(DataModel), instance.Org, instance.AppId, int.Parse(instance.InstanceOwner.PartyId), Guid.Parse(instance.Data.Where(de => de.DataType == [DATA_TYPE]).First().Id)); redigert = true; } } return await Task.FromResult(redigert); } ``` -------------------------------- ### Send SMS Notification on Task Start (C#) Source: https://docs.altinn.studio/nb/altinn-studio/v8/reference/logic/notifications/sms This C# code demonstrates how to send an SMS notification when a user starts filling out a form. It utilizes the `ISmsNotificationClient` interface and the `IProcessTaskStart` feature. The example shows how to construct an `SmsNotification` object with recipient details and a message body, and how to handle potential exceptions during the sending process. It requires the Altinn.App.Core NuGet package. ```csharp using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Altinn.App.Core.Features; using Altinn.App.Core.Internal.Notifications.Sms; using Altinn.App.Core.Models.Notifications.Sms; using Altinn.Platform.Storage.Interface.Models; using Microsoft.Extensions.Logging; namespace Altinn.App.Core; public class SmsOnStart(ILogger logger, ISmsNotificationClient smsNotificationClient) : IProcessTaskStart { public async Task Start(string taskId, Instance instance, Dictionary prefill) { // "Task_1" er navnet på skjema-steget i bpmn-prosessen if (taskId != "Task_1") return; try { var order = new SmsNotification { SenderNumber = "", Body = "Du har startet innfylling av skjema", SendersReference = "", Recipients = [new("0047XXXXXXXX")], }; using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); var orderResult = await smsNotificationClient.Order(order, default); logger.LogInformation( "Task started, SMS sent to {MobileNumber} - OrderId={OrderId}", order.Recipients[0].MobileNumber, orderResult.OrderId ); } catch (SmsNotificationException e) { logger.LogError(e, "Error sending SMS on task start"); } } } ``` -------------------------------- ### Instantiate Instance with Key-Value Prefill Source: https://docs.altinn.studio/nb/api/apps/instances Demonstrates how to instantiate a new instance with pre-filled data using a dictionary. The 'prefill' object maps keys to string values, which can correspond to data model bindings. Recursive models require matching keys. ```json { "instanceOwner": { "personNumber": "12247918309", "organisationNumber": null }, "prefill": { "navnGarantist" : "Ole Hansen", "addresse.gatenavn": "Gateveien", "addresse.husnummer": "4" }, "dueBefore": "2019-06-01T12:00:00Z", "visibleAfter": "2019-05-20T00:00:00Z" } ``` -------------------------------- ### Altinn 3 Correspondence Events Subscription Source: https://docs.altinn.studio/nb/correspondence/getting-started/developer-guides/events This section details how to set up an event subscription to receive notifications from Altinn 3 Correspondence. It explains the necessary filters and provides examples of event payloads. ```APIDOC ## Event Subscription Configuration ### Description Configure an event subscription endpoint to receive events published by Altinn Correspondence. This involves setting up specific filters to target the desired events. ### Method POST (Implied, as it involves setting up a subscription) ### Endpoint `/events/subscription` (Hypothetical endpoint for subscription management) ### Parameters #### Query Parameters - **sourceFilter** (string) - Required - The source URL for the events. Examples: - TT02: `https://platform.tt02.altinn.no/correspondence/api/v1/correspondence` - PROD: `https://api.altinn.no/correspondence/api/v1/correspondence` - **resourceFilter** (string) - Required - Filters events based on the resource ID. Format: `"urn:altinn:resource:" + ResourceID` - **alternativesubjectfilter** (string) - Optional - Filters events based on the subject. Can be an organization number (`"/organisation/(organization number)"`) or a person number (`"/person/(person number)"`). - **typeFilter** (string) - Optional - Filters events by their type. If not specified, all accessible event types are received. ### Request Body (Not explicitly defined, but would typically contain the subscription configuration details) ### Response #### Success Response (200) (Details of a successful subscription confirmation would be provided here) #### Response Example (Example response body for a successful subscription) ## Event Payload Structure ### Description All events published by Altinn Correspondence follow a standardized JSON structure. ### Method N/A (Event structure) ### Endpoint N/A (Event structure) ### Request Body ```json { "id": "string", "resource": "string", "resourceinstance": "string", "source": "string", "specversion": "string", "type": "string", "subject": "string", "alternativesubject": "string", "time": "string" } ``` ### Response #### Success Response (200) (This section describes the structure of an incoming event) #### Response Example ```json { "id": "1faa107f-3c0a-4fa6-9fce-7cee8838e258", "resource": "urn:altinn:resource:altinn-correspondence-test-resource-1", "resourceinstance": "da4ceacc-ad44-4e54-99b6-b58e3c13c785", "source": "https://platform.tt02.altinn.no/correspondence/api/v1/correspondence", "specversion": "1.0", "type": "no.altinn.correspondence.correspondencepublished", "subject": "urn:altinn:organization:identifier-no:123456789", "alternativesubject": "/organisation/123456789", "time": "2024-04-19T07:22:19.438039Z" } ``` ## Available Event Types ### Description This section lists the different event types that can be filtered and received, categorized for service owners and recipients. ### Method N/A (Event types) ### Endpoint N/A (Event types) ### Parameters #### Query Parameters - **typeFilter** (string) - Optional - Specifies the event type(s) to subscribe to. ### Available Event Types for Service Owners: - `no.altinn.correspondence.attachmentinitialized` - `no.altinn.correspondence.attachmentuploadprocessing` - `no.altinn.correspondence.attachmentpublished` - `no.altinn.correspondence.attachmentuploadfailed` - `no.altinn.correspondence.attachmentpurged` - `no.altinn.correspondence.attachmentdownloaded` - `no.altinn.correspondence.attachmentexpired` - `no.altinn.correspondence.correspondenceinitialized` - `no.altinn.correspondence.correspondencepublished` - `no.altinn.correspondence.correspondencepurged` - `no.altinn.correspondence.correspondencepublishfailed` - `no.altinn.correspondence.notificationcreated` - `no.altinn.correspondence.correspondencenotificationcreationfailed` ### Available Event Types for Recipients: - `no.altinn.correspondence.correspondencepublished` - `no.altinn.correspondence.correspondencereceiverread` - `no.altinn.correspondence.correspondencereceiverconfirmed` - `no.altinn.correspondence.Correspondencereceiverreserved` ``` -------------------------------- ### Fetch PDF Data from Altinn Storage (C#) Source: https://docs.altinn.studio/nb/altinn-studio/v8/guides/development/multi-app-solution/instructions/app-a Demonstrates how to fetch a PDF data element from Altinn Storage using either the instance object directly or the GetBinaryData method on the DataClient. Requires InstanceClient and/or DataClient to be configured. ```csharp using Altinn.Platform.Storage.Interface.Models; // Using the instance object directly with the GetInstance method on the InstanceClient Instance updatedInstance = await _instanceClient.GetInstance(innsendingsApp, mutliAppOwner, int.Parse(instance.InstanceOwner.PartyId), instanceGuid); DataElement pdf = updatedInstance.Data.FindLast(d => d.DataType == "ref-data-as-pdf"); // Using the GetBinaryData method on the DataClient var stream = await _dataClient.GetBinaryData(instance.Org, instance.AppId,int.Parse(instance.InstanceOwner.PartyId), instanceGuid, Guid.Parse(pdf.Id)); ``` -------------------------------- ### Starting k6, InfluxDB, and Grafana Docker Containers Source: https://docs.altinn.studio/nb/community/contributing/handbook/test/k6 This command uses Docker Compose to download and run the necessary Docker images for k6, InfluxDB, and Grafana in detached mode. This setup is required for local performance testing and result visualization. ```bash docker-compose up -d influxdb grafana ``` -------------------------------- ### Troubleshoot Corrupted Database with Docker Compose Source: https://docs.altinn.studio/nb/community/contributing/handbook/docker/without-docker-desktop/macos Command to start Docker Compose services with an extended timeout. This is an attempt to resolve issues with corrupted PostgreSQL databases due to improper shutdown, by allowing more time for the database system to recover. ```bash docker-compose up -d -t 20 ``` -------------------------------- ### Implementer egendefinert systemoppgave i C# Source: https://docs.altinn.studio/nb/altinn-studio/v8/guides/development/service-tasks/custom Denne koden viser hvordan man implementerer et egendefinert systemoppgave ved å bruke `IServiceTask`-interfacet i C#. Den henter instansdata, sjekker en spesifikk egenskap, og returnerer et resultat basert på utførelsen. Krever Altinn.App.Core og Altinn.Platform.Storage bibliotekene. ```csharp using System.Threading.Tasks; using Altinn.App.Core.Internal.Process.ProcessTasks.ServiceTasks; using Altinn.App.Core.Models; using Altinn.App.Models.model; using Altinn.Platform.Storage.Interface.Models; namespace Altinn.App.Code; public class ExampleServiceTask : IServiceTask { public string Type => "exampleServiceTask"; public async Task Execute(ServiceTaskContext context) { Instance instance = context.InstanceDataMutator.Instance; DataElement dataElement = instance.Data.Find(x => x.DataType == "model"); var formData = (model) await context.InstanceDataMutator.GetFormData(new DataElementIdentifier(dataElement)); if (formData.property1 != "true") return ServiceTaskResult.FailedAbortProcessNext(); return ServiceTaskResult.Success(); } } ``` -------------------------------- ### Altinn 3 Correspondence Event Payload Example Source: https://docs.altinn.studio/nb/correspondence/getting-started/developer-guides/events This JSON object represents a typical event payload published by Altinn 3 Correspondence. It includes details such as event ID, resource information, source URL, event type, and timestamps. This structure is crucial for understanding and processing events received via webhooks. ```json { "id": "1faa107f-3c0a-4fa6-9fce-7cee8838e258", "resource": "urn:altinn:resource:altinn-correspondence-test-resource-1", "resourceinstance": "da4ceacc-ad44-4e54-99b6-b58e3c13c785", "source": "https://platform.tt02.altinn.no/correspondence/api/v1/correspondence", "specversion": "1.0", "type": "no.altinn.correspondence.correspondencepublished", "subject": "urn:altinn:organization:identifier-no:123456789", "alternativesubject": "/organisation/123456789", "time": "2024-04-19T07:22:19.438039Z" } ``` -------------------------------- ### Create Agent System User Request Example - Altinn Studio API Source: https://docs.altinn.studio/nb/api/authentication/systemuserapi/systemuserrequest/external This example demonstrates how to construct a POST request to the Altinn Studio API to create a system user request of the agent type. It includes the external reference, system ID, party organization number, and access packages required for the request. The redirect URL can be specified or left empty. ```json { "externalRef": "at22_dhana_3103_02", "systemId": "991825827_dhana_ap", "partyOrgNo": "314250052", "accesspackages": [ { "urn":"urn:altinn:accesspackage:regnskapsforer-med-signeringsrettighet" } ], "redirectUrl": "" } ``` -------------------------------- ### Konfigurer betalingsprosess i BPMN Source: https://docs.altinn.studio/nb/altinn-studio/v8/guides/development/payment/backend-manual/add-process-task Dette BPMN-eksemplet viser hvordan man legger til et betalingstrinn i Altinn Studio-appen. Det definerer 'payment'-oppgavetypen, tilknyttede brukerhandlinger ('pay', 'confirm', 'reject'), og konfigurasjon for betalingsdata og kvitterings-PDF. Det inkluderer også en gateway for å håndtere 'reject'- og 'confirm'-handlinger. ```bpmn Flow_start_t1 Flow_start_t1 Flow_g1_t1 Flow_t1_t2 data Flow_t1_t2 Flow_t2_g1 payment confirm pay reject paymentInformation paymentReceiptPdf Flow_t2_g1 Flow_g1_t1 Flow_g1_end ["equals", ["gatewayAction"], "reject"] ["equals", ["gatewayAction"], "confirm"] Flow_g1_end ``` -------------------------------- ### Install Docker using Homebrew Source: https://docs.altinn.studio/nb/community/contributing/handbook/docker/without-docker-desktop/macos Installs the Docker command-line interface using the Homebrew package manager on macOS. This command should not be used with the `--cask` argument to avoid installing Docker Desktop. ```bash brew install docker ``` -------------------------------- ### Instantiation with key-value prefill Source: https://docs.altinn.studio/nb/api/apps/instances Allows instantiation of a new instance with pre-filled data. The prefill data is provided as a dictionary of string key-value pairs. ```APIDOC ## POST /instances ### Description Instantiates a new instance with pre-filled data. The `prefill` object accepts a `Dictionary` for key-value pairs. ### Method POST ### Endpoint /instances ### Request Body - **instanceOwner** (object) - Required - Information about the owner of the instance. - **personNumber** (string) - Optional - The person number of the instance owner. - **organisationNumber** (string) - Optional - The organisation number of the instance owner. - **prefill** (object) - Optional - Key-value pairs for pre-filling instance data. - **dueBefore** (string) - Optional - The date and time before which the instance is due. - **visibleAfter** (string) - Optional - The date and time after which the instance will be visible. ### Request Example ```json { "instanceOwner": { "personNumber": "12247918309", "organisationNumber": null }, "prefill": { "navnGarantist" : "Ole Hansen", "addresse.gatenavn": "Gateveien", "addresse.husnummer": "4" }, "dueBefore": "2019-06-01T12:00:00Z", "visibleAfter": "2019-05-20T00:00:00Z" } ``` ### Response #### Success Response (201 Created) - **instanceId** (string) - The unique identifier of the created instance. - **instanceOwnerPartyId** (string) - The party ID of the instance owner. #### Response Example ```json { "instanceId": "50002108/a1b2c3d4-e5f6-7890-1234-567890abcdef", "instanceOwnerPartyId": "50002108" } ``` ``` -------------------------------- ### Kalle CreateNewInstance fra ProcessTaskEnd i C# Source: https://docs.altinn.studio/nb/altinn-studio/v8/guides/development/multi-app-solution/instructions/app-a Dette kodeeksemplet viser hvordan du kaller den nylig implementerte `CreateNewInstance`-metoden fra `AppInstantiationClient` innenfor `ProcessTaskEnd.cs`-filen. Dette utløser opprettelsen av en ny instans av applikasjon B. ```csharp Instance applicationBInstance = await _appInstantiationClient.CreateNewInstance([AppOwnerOrgName], [applicationB], [instanceTemplate]); ``` -------------------------------- ### Konfigurer tilgangsstyring for egendefinert systemoppgave Source: https://docs.altinn.studio/nb/altinn-studio/v8/guides/development/service-tasks/custom Dette XACML-eksempelet viser hvordan man konfigurerer tilgangsstyring for en egendefinert systemoppgave. Ved å legge til `exampleServiceTask` som en action i `policy.xml`, gis brukeren som driver prosessen videre, rettighetene til å utføre denne oppgaven. Dette sikrer at kun autoriserte handlinger kan utføres. ```xml exampleServiceTask ```