├── Dialogporten ├── EndUser │ ├── Dialogs │ │ ├── folder.bru │ │ ├── Single dialog.bru │ │ ├── Set System Label.bru │ │ └── List Dialogs.bru │ ├── LabelLog │ │ ├── folder.bru │ │ └── Label Log.bru │ ├── Parties │ │ ├── folder.bru │ │ └── parties.bru │ ├── DialogSeenLog │ │ ├── folder.bru │ │ ├── List records.bru │ │ └── Single record.bru │ ├── DialogActivities │ │ ├── folder.bru │ │ ├── List activities.bru │ │ └── Single activity.bru │ ├── DialogTransmissions │ │ ├── folder.bru │ │ ├── List transmissions.bru │ │ └── Single transmission.bru │ ├── DialogSystemLabel │ │ ├── folder.bru │ │ └── Bulk update Dialogs Labels.bru │ └── folder.bru ├── WellKnown │ ├── folder.bru │ ├── jwks.json.bru │ └── oauth-authorization-server.bru ├── ServiceOwner │ ├── DialogSeenLog │ │ ├── folder.bru │ │ ├── List records.bru │ │ └── Single record.bru │ ├── DialogActivities │ │ ├── folder.bru │ │ ├── List activities.bru │ │ ├── Notification Conditition.bru │ │ ├── Single activity.bru │ │ └── Create activity.bru │ ├── DialogTransmissions │ │ ├── folder.bru │ │ ├── List transmissions.bru │ │ ├── Single transmission.bru │ │ └── Create transmission.bru │ ├── DialogSystemLabel │ │ ├── folder.bru │ │ └── Bulk set.bru │ ├── Dialogs │ │ ├── Restore dialog.bru │ │ ├── Delete dialog.bru │ │ ├── Get Single dialog.bru │ │ ├── Purge dialog.bru │ │ ├── List dialogs.bru │ │ ├── folder.bru │ │ ├── notification condition.bru │ │ ├── Patch Single dialog.bru │ │ ├── Create minimal dialog.bru │ │ ├── Update dialog.bru │ │ ├── Create dialog.bru │ │ └── gql-post-test.bru │ └── folder.bru ├── folder.bru └── Testing │ ├── Generate exception.bru │ └── folder.bru ├── Altinn Platform ├── folder.bru ├── Authentication │ ├── folder.bru │ ├── Exchange.bru │ ├── SystemUserToken.bru │ ├── IDPortenToken.bru │ └── EnterpriseToken.bru ├── Storage │ ├── Instances │ │ ├── events │ │ │ ├── folder.bru │ │ │ ├── Gets all instances in a given state for a given instance owner. Copy.bru │ │ │ └── Query events.bru │ │ ├── datavalues │ │ │ ├── folder.bru │ │ │ └── Updates the data values on an instance.bru │ │ ├── Single instance.bru │ │ ├── Query instances.bru │ │ ├── Process history.bru │ │ ├── Single instance data.bru │ │ ├── Gets all instances in a given state for a given instance owner. Copy.bru │ │ └── folder.bru │ ├── Applications │ │ ├── folder.bru │ │ ├── Get metadata for all apps.bru │ │ ├── Get metadata for a single app.bru │ │ ├── Get text resources for a single app.bru │ │ ├── Set text resource for a single app.bru │ │ └── update metadata for a single app.bru │ └── folder.bru ├── Events │ ├── subscriptions │ │ ├── folder.bru │ │ ├── Get a specific subscription.bru │ │ ├── subscription for person │ │ │ ├── Get a specific subscription.bru │ │ │ ├── Get all subscription for the authorized consumer.bru │ │ │ ├── Delete a given subscription.bru │ │ │ ├── folder.bru │ │ │ └── Register an subscription for events.bru │ │ ├── Get all subscription for the authorized consumer.bru │ │ ├── Delete a given subscription.bru │ │ └── Register an subscription for events.bru │ ├── folder.bru │ ├── events │ │ ├── folder.bru │ │ ├── Retrieves a set of events related based on query parameters.bru │ │ └── Retrieves a set of events related based on query parameters. Copy.bru │ └── Endpoint for posting a new cloud event.bru ├── Authorization (external) │ ├── Decision │ │ ├── folder.bru │ │ └── authorize.bru │ └── folder.bru ├── ResourceRegistry │ ├── ResourceList.bru │ ├── Get Resource.bru │ ├── Updated.bru │ ├── Get Policy.bru │ ├── Resource by roles.bru │ ├── Search.bru │ ├── Update policy.bru │ ├── Create Policy.bru │ ├── folder.bru │ ├── Update resource.bru │ └── Create Resource.bru ├── Register │ ├── folder.bru │ └── NamesLookup.bru └── AccessManagement │ ├── folder.bru │ └── Resource Owner authorized parties.bru ├── collection.bru ├── environments ├── Staging.bru ├── Local development.bru ├── Production.bru ├── Local development (Docker).bru ├── YT01.bru └── Test (AT23).bru ├── bruno.json ├── .gitignore ├── example.env ├── LICENSE ├── README.md └── pre_request.js /Dialogporten/EndUser/Dialogs/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Dialogs 3 | } 4 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/LabelLog/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: LabelLog 3 | } 4 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/Parties/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Parties 3 | } 4 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/DialogSeenLog/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: DialogSeenLog 3 | } 4 | -------------------------------------------------------------------------------- /Dialogporten/WellKnown/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: WellKnown 3 | seq: 3 4 | } 5 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogSeenLog/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: DialogSeenLog 3 | } 4 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/DialogActivities/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: DialogActivities 3 | } 4 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/DialogTransmissions/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: DialogTransmissions 3 | } 4 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogActivities/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: DialogActivities 3 | } 4 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogTransmissions/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: DialogTransmissions 3 | } 4 | -------------------------------------------------------------------------------- /Dialogporten/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Dialogporten 3 | seq: 3 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | -------------------------------------------------------------------------------- /Altinn Platform/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Altinn Platform 3 | seq: 2 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | -------------------------------------------------------------------------------- /Altinn Platform/Authentication/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Authentication 3 | seq: 2 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Instances/events/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: events 3 | seq: 2 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | -------------------------------------------------------------------------------- /Altinn Platform/Events/subscriptions/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: subscriptions 3 | seq: 1 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | -------------------------------------------------------------------------------- /Altinn Platform/Authorization (external)/Decision/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Decision 3 | seq: 1 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Instances/datavalues/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: datavalues 3 | seq: 1 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/DialogSystemLabel/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: DialogSystemLabel 3 | seq: 7 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogSystemLabel/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: DialogSystemLabel 3 | seq: 5 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/Parties/parties.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: parties 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/enduser/parties 9 | body: none 10 | auth: none 11 | } 12 | -------------------------------------------------------------------------------- /Dialogporten/Testing/Generate exception.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Generate exception 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/exception 9 | body: none 10 | auth: none 11 | } 12 | -------------------------------------------------------------------------------- /Dialogporten/WellKnown/jwks.json.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: jwks.json 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/.well-known/jwks.json 9 | body: none 10 | auth: none 11 | } 12 | -------------------------------------------------------------------------------- /Dialogporten/WellKnown/oauth-authorization-server.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: oauth-authorization-server 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/.well-known/oauth-authorization-server 9 | body: none 10 | auth: none 11 | } 12 | -------------------------------------------------------------------------------- /collection.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Dialogporten 3 | seq: 1 4 | } 5 | 6 | auth { 7 | mode: none 8 | } 9 | 10 | script:pre-request { 11 | const Altinn = require('./pre_request.js'); 12 | } 13 | 14 | docs { 15 | Altinn Request collection for Dialogporten 16 | } 17 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/Restore dialog.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Restore dialog 3 | type: http 4 | seq: 11 5 | } 6 | 7 | post { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/0194cae5-56fe-741c-8c2f-4dc8bff4faab/actions/restore 9 | body: none 10 | auth: none 11 | } 12 | -------------------------------------------------------------------------------- /environments/Staging.bru: -------------------------------------------------------------------------------- 1 | vars { 2 | baseUrlPlatform: https://platform.tt02.altinn.no 3 | tokenEnvName: tt02 4 | baseUrl: https://platform.tt02.altinn.no/dialogporten 5 | baseUrlGQL: https://platform.tt02.altinn.no/dialogporten/graphql 6 | SubscriptionKey: {{process.env.SubKey_TT02}} 7 | } 8 | -------------------------------------------------------------------------------- /environments/Local development.bru: -------------------------------------------------------------------------------- 1 | vars { 2 | baseUrlPlatform: http://localhost:5080 3 | tokenEnvName: tt02 4 | SubscriptionKey: notset 5 | baseUrl: https://localhost:7214 6 | idporten-client_secret: 7 | idporten-client_id: 8 | baseUrlGQL: http://localhost:5181/graphql 9 | } 10 | -------------------------------------------------------------------------------- /environments/Production.bru: -------------------------------------------------------------------------------- 1 | vars { 2 | baseUrlPlatform: https://platform.altinn.no 3 | UseMaskinportenTokenGenerator: true 4 | baseUrl: https://platform.altinn.no/dialogporten 5 | baseUrlGQL: https://platform.altinn.no/dialogporten/graphql 6 | SubscriptionKey: {{process.env.SubKey_PROD}} 7 | } 8 | -------------------------------------------------------------------------------- /environments/Local development (Docker).bru: -------------------------------------------------------------------------------- 1 | vars { 2 | baseUrlPlatform: http://localhost:5080 3 | tokenEnvName: tt02 4 | SubscriptionKey: notset 5 | baseUrl: http://localhost:7214 6 | idporten-client_secret: 7 | idporten-client_id: 8 | baseUrlGQL: http://localhost:5181/graphql 9 | } 10 | -------------------------------------------------------------------------------- /environments/YT01.bru: -------------------------------------------------------------------------------- 1 | vars { 2 | baseUrlPlatform: https://platform.yt01.altinn.cloud 3 | tokenEnvName: yt01 4 | baseUrl: https://platform.yt01.altinn.cloud/dialogporten 5 | baseUrlGQL: https://platform.yt01.altinn.cloud/dialogporten/graphql 6 | SubscriptionKey: {{process.env.SubKey_YT01}} 7 | } 8 | -------------------------------------------------------------------------------- /Altinn Platform/ResourceRegistry/ResourceList.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: ResourceList 3 | type: http 4 | seq: 8 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/resourceregistry/api/v1/resource/resourcelist 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | settings { 14 | encodeUrl: true 15 | } 16 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/Dialogs/Single dialog.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Single dialog 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/enduser/dialogs/:dialogId 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 01950f57-db06-76a7-b620-45cc99778dd0 15 | } 16 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Applications/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Applications 3 | seq: 2 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | 10 | script:pre-request { 11 | await (new Altinn(req)).Authenticate({ 12 | "tokenType": "platform", 13 | "app": "studio.designer" 14 | }); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/LabelLog/Label Log.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Label Log 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/enduser/dialogs/:dialogId/labellog 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 0192511e-43aa-71a4-aa68-6ec2941aacea 15 | } 16 | -------------------------------------------------------------------------------- /bruno.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "name": "Altinn", 4 | "type": "collection", 5 | "ignore": [ 6 | "node_modules", 7 | ".git", 8 | ".idea" 9 | ], 10 | "size": 1.015777587890625, 11 | "filesCount": 466, 12 | "clientCertificates": { 13 | "enabled": true, 14 | "certs": [] 15 | } 16 | } -------------------------------------------------------------------------------- /Dialogporten/EndUser/DialogSeenLog/List records.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: List records 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/enduser/dialogs/:dialogId/seenLog 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: cbc28e01-7640-3674-bb2a-9ab0ecd22ba6 15 | } 16 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/Delete dialog.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Delete dialog 3 | type: http 4 | seq: 9 5 | } 6 | 7 | delete { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 0c958b01-13c7-6174-8ab0-31f3674845af 15 | } 16 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/Get Single dialog.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Get Single dialog 3 | type: http 4 | seq: 7 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 019324db-9e5f-740a-8538-2f16ffcd1a4b 15 | } 16 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/DialogActivities/List activities.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: List activities 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/enduser/dialogs/:dialogId/activities 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 8a1d8a01-516a-7772-b618-06d14c0fb122 15 | } 16 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogSeenLog/List records.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: List records 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId/seenLog 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: cbc28e01-7640-3674-bb2a-9ab0ecd22ba6 15 | } 16 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/Purge dialog.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Purge dialog 3 | type: http 4 | seq: 10 5 | } 6 | 7 | post { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId/actions/purge 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 01923282-e30f-72db-ad8a-ce74c6ad7c89 15 | } 16 | -------------------------------------------------------------------------------- /Altinn Platform/Authentication/Exchange.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Exchange 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/authentication/api/v1/exchange/maskinporten 9 | body: none 10 | auth: bearer 11 | } 12 | 13 | auth:bearer { 14 | token: 15 | } 16 | 17 | settings { 18 | encodeUrl: true 19 | } 20 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogActivities/List activities.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: List activities 3 | type: http 4 | seq: 3 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId/activities 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: e6268a01-aa24-fe73-a56d-a3e04c62c34f 15 | } 16 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/DialogTransmissions/List transmissions.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: List transmissions 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/enduser/dialogs/:dialogId/transmissions 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: a1f99001-ed97-f176-b3d9-f4d04847b140 15 | } 16 | -------------------------------------------------------------------------------- /environments/Test (AT23).bru: -------------------------------------------------------------------------------- 1 | vars { 2 | baseUrlPlatform: https://platform.at23.altinn.cloud 3 | tokenEnvName: at23 4 | baseUrl: https://altinn-dev-api.azure-api.net/dialogporten 5 | baseUrlGQL: https://altinn-dev-api.azure-api.net/dialogporten/graphql 6 | scopes: digdir:dialogporten.developer.test 7 | SubscriptionKey: {{process.env.SubKey_AT23}} 8 | } 9 | -------------------------------------------------------------------------------- /Altinn Platform/ResourceRegistry/Get Resource.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Get Resource 3 | type: http 4 | seq: 5 5 | } 6 | 7 | delete { 8 | url: {{baseUrlPlatform}}/resourceregistry/api/v1/resource/:id 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | id: super-simple-service 15 | } 16 | 17 | settings { 18 | encodeUrl: true 19 | } 20 | -------------------------------------------------------------------------------- /Altinn Platform/ResourceRegistry/Updated.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Updated 3 | type: http 4 | seq: 7 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/resourceregistry/api/v1/resource/updated 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | ~ResourceType: SystemResource 15 | } 16 | 17 | settings { 18 | encodeUrl: true 19 | } 20 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogTransmissions/List transmissions.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: List transmissions 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId/transmissions 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 43fe9001-2dd4-4876-91b8-69b8becfb3d7 15 | } 16 | -------------------------------------------------------------------------------- /Altinn Platform/ResourceRegistry/Get Policy.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Get Policy 3 | type: http 4 | seq: 12 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/resourceregistry/api/v1/resource/:Id/Policy 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | Id: super-simple-service 15 | } 16 | 17 | settings { 18 | encodeUrl: true 19 | } 20 | -------------------------------------------------------------------------------- /Altinn Platform/Events/subscriptions/Get a specific subscription.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Get a specific subscription 3 | type: http 4 | seq: 4 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/events/api/v1/subscriptions/:id 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | id: 33382348 15 | } 16 | 17 | settings { 18 | encodeUrl: true 19 | } 20 | -------------------------------------------------------------------------------- /Altinn Platform/Register/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Register 3 | seq: 6 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | 10 | script:pre-request { 11 | await (new Altinn(req)).Authenticate({ 12 | "tokenType": "enterprise", 13 | "orgNo": "991825827", 14 | //"org": "digdir", 15 | "scopes": "altinn:register/partylookup.admin" 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogActivities/Notification Conditition.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Notification Conditition 3 | type: http 4 | seq: 4 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId/notification-condition 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: e6268a01-aa24-fe73-a56d-a3e04c62c34f 15 | } 16 | -------------------------------------------------------------------------------- /Altinn Platform/Events/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Events 3 | seq: 5 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | 10 | script:pre-request { 11 | await (new Altinn(req)).Authenticate({ 12 | "tokenType": "enterprise", 13 | "orgNo": "991825827", // Digdir 14 | "org": "digdir", 15 | "scopes": "altinn:events.publish altinn:events.subscribe" 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/DialogSeenLog/Single record.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Single record 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/enduser/dialogs/:dialogId/seenlog/:seenLogId 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: cbc28e01-7640-3674-bb2a-9ab0ecd22ba6 15 | seenLogId: 44e7b86a-6813-4457-a432-9a1564f28b40 16 | } 17 | -------------------------------------------------------------------------------- /Altinn Platform/Events/subscriptions/subscription for person/Get a specific subscription.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Get a specific subscription 3 | type: http 4 | seq: 3 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/events/api/v1/subscriptions/:id 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | id: 33382348 15 | } 16 | 17 | settings { 18 | encodeUrl: true 19 | } 20 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogSeenLog/Single record.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Single record 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId/seenLog/:seenLogId 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: cbc28e01-7640-3674-bb2a-9ab0ecd22ba6 15 | seenLogId: 44e7b86a-6813-4457-a432-9a1564f28b40 16 | } 17 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Instances/Single instance.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Single instance 3 | type: http 4 | seq: 5 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/storage/api/v1/instances/:partyid/:instanceid 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | partyid: {{PARTYID}} 15 | instanceid: {{INSTANCEID}} 16 | } 17 | 18 | settings { 19 | encodeUrl: true 20 | } 21 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/DialogActivities/Single activity.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Single activity 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/enduser/dialogs/:dialogId/activities/:activityId 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 8a1d8a01-516a-7772-b618-06d14c0fb122 15 | activityId: 8a1d8a01-556a-ee76-9836-06ca3be3e3d3 16 | } 17 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/Dialogs/Set System Label.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Set System Label 3 | type: http 4 | seq: 3 5 | } 6 | 7 | put { 8 | url: {{baseUrl}}/api/v1/enduser/dialogs/:dialogId/systemlabels/ 9 | body: json 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 0192511e-43aa-71a4-aa68-6ec2941aacea 15 | } 16 | 17 | body:json { 18 | { 19 | "label": "bin" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Altinn Platform/AccessManagement/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: AccessManagement 3 | seq: 7 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | 10 | script:pre-request { 11 | await (new Altinn(req)).Authenticate({ 12 | "tokenType": "enterprise", 13 | "orgNo": "991825827", 14 | // "org": "digdir", 15 | "scopes": "altinn:accessmanagement/authorizedparties.admin" 16 | }); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Instances/Query instances.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Query instances 3 | type: http 4 | seq: 4 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/storage/api/v1/instances?org=ttd&size=1000 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | org: ttd 15 | size: 1000 16 | ~instanceOwner.partyId: 50756302 17 | } 18 | 19 | settings { 20 | encodeUrl: true 21 | } 22 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogActivities/Single activity.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Single activity 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId/activities/:activityId 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: e6268a01-aa24-fe73-a56d-a3e04c62c34f 15 | activityId: 772c8a01-38c7-e777-b23e-d285ff3c1fd4 16 | } 17 | -------------------------------------------------------------------------------- /Altinn Platform/Events/subscriptions/Get all subscription for the authorized consumer.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Get all subscription for the authorized consumer 3 | type: http 4 | seq: 3 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/events/api/v1/subscriptions 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | headers { 14 | Accept: application/json 15 | } 16 | 17 | settings { 18 | encodeUrl: true 19 | } 20 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Instances/Process history.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Process history 3 | type: http 4 | seq: 7 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/storage/api/v1/instances/:partyid/:instanceid/process/history 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | partyid: {{PARTYID}} 15 | instanceid: {{INSTANCEID}} 16 | } 17 | 18 | settings { 19 | encodeUrl: true 20 | } 21 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/DialogTransmissions/Single transmission.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Single transmission 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/enduser/dialogs/:dialogId/transmissions/:transmissionId 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 3efb9001-17af-4d72-bdb4-13b0c2581f6c 15 | transmissionId: 3efb9001-18af-0c72-8e84-02dc88d1f7e1 16 | } 17 | -------------------------------------------------------------------------------- /Altinn Platform/Authorization (external)/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Authorization (external) 3 | seq: 4 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | 10 | script:pre-request { 11 | await (new Altinn(req)).Authenticate({ 12 | "orgNo": "991825827", // Digdir 13 | //"orgNo": "889640782", // NAV 14 | "tokenType": "enterprise", 15 | "scopes": "altinn:authorization/authorize.admin" 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Applications/Get metadata for all apps.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Get metadata for all apps 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/storage/api/v1/applications/:org 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | org: ttd 15 | } 16 | 17 | headers { 18 | Accept: application/json 19 | } 20 | 21 | settings { 22 | encodeUrl: true 23 | } 24 | -------------------------------------------------------------------------------- /Altinn Platform/Events/subscriptions/Delete a given subscription.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Delete a given subscription 3 | type: http 4 | seq: 5 5 | } 6 | 7 | delete { 8 | url: {{baseUrlPlatform}}/events/api/v1/subscriptions/:id 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | id: 3177 15 | } 16 | 17 | headers { 18 | Accept: application/json 19 | } 20 | 21 | settings { 22 | encodeUrl: true 23 | } 24 | -------------------------------------------------------------------------------- /Altinn Platform/ResourceRegistry/Resource by roles.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Resource by roles 3 | type: http 4 | seq: 13 5 | } 6 | 7 | post { 8 | url: {{baseUrlPlatform}}/resourceregistry/api/v1/resource/bysubjects 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | body:json { 14 | [ 15 | "urn:altinn:rolecode:siskd", 16 | "urn:altinn:rolecode:dagl" 17 | ] 18 | } 19 | 20 | settings { 21 | encodeUrl: true 22 | } 23 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogTransmissions/Single transmission.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Single transmission 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId/transmissions/:transmissionId 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 3efb9001-17af-4d72-bdb4-13b0c2581f6c 15 | transmissionId: 3efb9001-18af-0c72-8e84-02dc88d1f7e1 16 | } 17 | -------------------------------------------------------------------------------- /Altinn Platform/ResourceRegistry/Search.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Search 3 | type: http 4 | seq: 6 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/resourceregistry/api/v1/resource/Search?Id=ttd-altinn-events-automated-tests 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | Id: ttd-altinn-events-automated-tests 15 | ~ResourceType: SystemResource 16 | } 17 | 18 | settings { 19 | encodeUrl: true 20 | } 21 | -------------------------------------------------------------------------------- /Altinn Platform/Events/subscriptions/subscription for person/Get all subscription for the authorized consumer.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Get all subscription for the authorized consumer 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/events/api/v1/subscriptions 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | headers { 14 | Accept: application/json 15 | } 16 | 17 | settings { 18 | encodeUrl: true 19 | } 20 | -------------------------------------------------------------------------------- /Altinn Platform/ResourceRegistry/Update policy.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Update policy 3 | type: http 4 | seq: 11 5 | } 6 | 7 | put { 8 | url: {{baseUrlPlatform}}/resourceregistry/api/v1/resource/:Id/Policy 9 | body: multipartForm 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | Id: super-simple-service 15 | } 16 | 17 | body:multipart-form { 18 | policyFile: @file() 19 | } 20 | 21 | settings { 22 | encodeUrl: true 23 | } 24 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Instances/Single instance data.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Single instance data 3 | type: http 4 | seq: 8 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/storage/api/v1/instances/:partyid/:instanceid/data/:dataid 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | partyid: {{PARTYID}} 15 | instanceid: {{INSTANCEID}} 16 | dataid: 17 | } 18 | 19 | settings { 20 | encodeUrl: true 21 | } 22 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/List dialogs.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: List dialogs 3 | type: http 4 | seq: 5 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/ 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | ~Limit: 3 15 | ~OrderBy: dueAt_asc,updatedAt_desc 16 | ~Search: title-search-hit 17 | ~CreatedAfter: 2023-10-27T10:00:00Z 18 | } 19 | 20 | headers { 21 | Accept: text/plain 22 | } 23 | -------------------------------------------------------------------------------- /Altinn Platform/Events/subscriptions/subscription for person/Delete a given subscription.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Delete a given subscription 3 | type: http 4 | seq: 4 5 | } 6 | 7 | delete { 8 | url: {{baseUrlPlatform}}/events/api/v1/subscriptions/:id 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | id: 3177 15 | } 16 | 17 | headers { 18 | Accept: application/json 19 | } 20 | 21 | settings { 22 | encodeUrl: true 23 | } 24 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Dialogs 3 | seq: 1 4 | } 5 | 6 | script:pre-request { 7 | bru.setVar("PARTY_PERSON", "urn:altinn:person:identifier-no:08895699684"); // ROMANTISK DRÅPE 8 | //bru.setVar("PARTY_ORGANIZATION", "urn:altinn:organization:identifier-no:313345475"); // SLAKK ULYDIG TIGER AS 9 | bru.setVar("PARTY_ORGANIZATION", "urn:altinn:organization:identifier-no:313345475"); // SLAKK ULYDIG TIGER AS 10 | } 11 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Applications/Get metadata for a single app.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Get metadata for a single app 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/storage/api/v1/applications/:org/:app 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | org: ttd 15 | app: apps-test-prod 16 | } 17 | 18 | headers { 19 | Accept: application/json 20 | } 21 | 22 | settings { 23 | encodeUrl: true 24 | } 25 | -------------------------------------------------------------------------------- /Altinn Platform/ResourceRegistry/Create Policy.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Create Policy 3 | type: http 4 | seq: 10 5 | } 6 | 7 | post { 8 | url: {{baseUrlPlatform}}/resourceregistry/api/v1/resource/:Id/Policy 9 | body: multipartForm 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | Id: super-simple-service 15 | } 16 | 17 | headers { 18 | Content: text/xml 19 | } 20 | 21 | body:multipart-form { 22 | policyFile: @file() 23 | } 24 | 25 | settings { 26 | encodeUrl: true 27 | } 28 | -------------------------------------------------------------------------------- /Altinn Platform/Register/NamesLookup.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: NamesLookup 3 | type: http 4 | seq: 3 5 | } 6 | 7 | post { 8 | url: {{baseUrlPlatform}}/register/api/v1/parties/nameslookup 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | headers { 14 | Ocp-Apim-Subscription-Key: {{SubscriptionKey}} 15 | } 16 | 17 | body:json { 18 | { 19 | "parties": [ 20 | { 21 | "OrgNo": "991825827" 22 | } 23 | ] 24 | } 25 | } 26 | 27 | settings { 28 | encodeUrl: true 29 | } 30 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Storage 3 | seq: 8 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | 10 | script:pre-request { 11 | await (new Altinn(req)).Authenticate({ 12 | "tokenType": "enterprise", 13 | "orgNo": "991825827", 14 | "org": "ttd", 15 | "scopes": "altinn:serviceowner/instances.read" 16 | }); 17 | 18 | 19 | bru.setVar("PARTYID", "50759986"); 20 | bru.setVar("INSTANCEID", "26a7cdaf-4b1b-41f5-81a1-3ab1231ff895"); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/notification condition.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: notification condition 3 | type: http 4 | seq: 6 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId/actions/should-send-notification?conditionType=Exists&activityType=DialogCreated 9 | body: none 10 | auth: none 11 | } 12 | 13 | params:query { 14 | conditionType: Exists 15 | activityType: DialogCreated 16 | } 17 | 18 | params:path { 19 | dialogId: 01934ea4-123c-7214-8168-022367528297 20 | } 21 | -------------------------------------------------------------------------------- /Dialogporten/Testing/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Testing 3 | seq: 3 4 | } 5 | 6 | script:pre-request { 7 | await (new Altinn(req)).Authenticate({ 8 | "orgNo": "991825827", // Digdir 9 | //"orgNo": "974761076", // Skatteetaten 10 | //"orgNo": "889640782", // NAV 11 | "tokenType": "enterprise", 12 | "scopes": "digdir:dialogporten.serviceprovider digdir:dialogporten.serviceprovider.search altinn:system/notifications.condition.check digdir:dialogporten.developer.test" 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Applications/Get text resources for a single app.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Get text resources for a single app 3 | type: http 4 | seq: 4 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/storage/api/v1/applications/:org/:app/texts/:language 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | org: ttd 15 | app: testdriver-for-arbeidsflate 16 | language: nb 17 | } 18 | 19 | headers { 20 | Accept: application/json 21 | } 22 | 23 | settings { 24 | encodeUrl: true 25 | } 26 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Instances/events/Gets all instances in a given state for a given instance owner. Copy.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Gets all instances in a given state for a given instance owner. Copy 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/sbl/instances/:instanceOwnerPartyId/:instanceGuid/events 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | instanceOwnerPartyId: {{PARTYID}} 15 | instanceGuid: {{INSTANCEID}} 16 | } 17 | 18 | settings { 19 | encodeUrl: true 20 | } 21 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/DialogSystemLabel/Bulk update Dialogs Labels.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Bulk update Dialogs Labels 3 | type: http 4 | seq: 1 5 | } 6 | 7 | post { 8 | url: {{baseUrl}}/api/v1/enduser/dialogs/context/systemLabels/actions/bulkUpdate 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | body:json { 14 | { 15 | "systemLabels": ["bin"], 16 | "dialogIds": ["0198e101-368f-72e6-85f1-1f06d5e5fdcf", "0198e101-a46d-7702-b3aa-897ba8d47562"] 17 | } 18 | } 19 | 20 | settings { 21 | encodeUrl: true 22 | } 23 | -------------------------------------------------------------------------------- /Altinn Platform/Events/events/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: events 3 | seq: 2 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | 10 | script:pre-request { 11 | // (new Altinn(pm)).Authenticate({ 12 | // "orgNo": "991825827", // Digdir 13 | // //"orgNo": "889640782", // NAV 14 | // //"orgNo": "974760673", // BRG 15 | // //"orgNo": "974761076", // Skatteetaten 16 | // //"tokenType": "enterprise", 17 | 18 | // "pid": "14886498226", 19 | // "scopes": "altinn:events.subscribe" 20 | // }); 21 | } 22 | -------------------------------------------------------------------------------- /Altinn Platform/Events/subscriptions/subscription for person/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: subscription for person 3 | seq: 1 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | 10 | script:pre-request { 11 | await (new Altinn(req)).Authenticate({ 12 | "tokenType": "person", 13 | "scopes": "altinn:events.subscribe", 14 | "pid": "14886498226", // ORDINÆR HJELPELINJE, DAGL for 212475912 15 | "partyId": "51198414", // ORDINÆR HJELPELINJE (TT02) 16 | "userId": "1263321", // ORDINÆR HJELPELINJE (TT02) 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /Altinn Platform/AccessManagement/Resource Owner authorized parties.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Resource Owner authorized parties 3 | type: http 4 | seq: 1 5 | } 6 | 7 | post { 8 | url: {{baseUrlPlatform}}/accessmanagement/api/v1/resourceowner/authorizedparties?includeAltinn2=true 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | includeAltinn2: true 15 | } 16 | 17 | body:json { 18 | 19 | { 20 | "type": "urn:altinn:person:identifier-no", 21 | "value": "07117000413" 22 | } 23 | } 24 | 25 | settings { 26 | encodeUrl: true 27 | } 28 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: ServiceOwner 3 | seq: 3 4 | } 5 | 6 | script:pre-request { 7 | await (new Altinn(req)).Authenticate({ 8 | "orgNo": "991825827", // Digdir 9 | // "orgNo": "974761076", // Skatteetaten 10 | //"orgNo": "889640782", // NAV 11 | "tokenType": "enterprise", 12 | "org": "digdir", 13 | "scopes": "digdir:dialogporten.serviceprovider digdir:dialogporten.serviceprovider.search digdir:dialogporten.serviceprovider.legacyhtml altinn:system/notifications.condition.check digdir:dialogporten.correspondence" 14 | }); 15 | } 16 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Instances/events/Query events.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Query events 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/storage/api/v1/instances/:instanceOwnerPartyId/:instanceGuid/events 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | ~eventTypes: 15 | ~from: 16 | ~to: 17 | } 18 | 19 | params:path { 20 | instanceOwnerPartyId: {{PARTYID}} 21 | instanceGuid: {{INSTANCEID}} 22 | } 23 | 24 | headers { 25 | Accept: application/json 26 | } 27 | 28 | settings { 29 | encodeUrl: true 30 | } 31 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/Patch Single dialog.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Patch Single dialog 3 | type: http 4 | seq: 8 5 | } 6 | 7 | patch { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId 9 | body: json 10 | auth: none 11 | } 12 | 13 | params:query { 14 | ~: null 15 | } 16 | 17 | params:path { 18 | dialogId: 019593e2-4085-75e4-8d81-e2b503466294 19 | } 20 | 21 | headers { 22 | Content-Type: application/json-patch+json 23 | } 24 | 25 | body:json { 26 | [ 27 | { 28 | "op": "replace", 29 | "path": "progress", 30 | "value": 2 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /Altinn Platform/ResourceRegistry/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: ResourceRegistry 3 | seq: 1 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | 10 | script:pre-request { 11 | await (new Altinn(req)).Authenticate({ 12 | // "orgNo": "713431400", // Digdir yt01 13 | "orgNo": "991825827", // Digdir 14 | // "orgNo": "889640782", // NAV 15 | // "orgNo": "974760673", // BRG 16 | // "orgNo": "974761076", // Skatteetaten 17 | "org": "digdir", 18 | "tokenType": "enterprise", 19 | "scopes": "altinn:resourceregistry/resource.write altinn:resourceregistryresource.read altinn:resourceregistry/resource.admin" 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Instances/Gets all instances in a given state for a given instance owner. Copy.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Gets all instances in a given state for a given instance owner. Copy 3 | type: http 4 | seq: 9 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/storage/api/v1/sbl/instances/:instanceOwnerPartyId/:instanceGuid?language=nb 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | language: nb 15 | ~: null 16 | } 17 | 18 | params:path { 19 | instanceOwnerPartyId: {{PARTYID}} 20 | instanceGuid: {{INSTANCEID}} 21 | } 22 | 23 | headers { 24 | Ocp-Apim-Subscription-Key: {{SubscriptionKey}} 25 | } 26 | 27 | settings { 28 | encodeUrl: true 29 | } 30 | -------------------------------------------------------------------------------- /Altinn Platform/Events/subscriptions/Register an subscription for events.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Register an subscription for events. 3 | type: http 4 | seq: 2 5 | } 6 | 7 | post { 8 | url: {{baseUrlPlatform}}/events/api/v1/subscriptions 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | headers { 14 | Content-Type: application/json 15 | Accept: application/json 16 | } 17 | 18 | body:json { 19 | { 20 | "endpoint": "https://eosmgovlpmlz4lx.m.pipedream.net?code=SUPERSECRETKEY", 21 | "resourceFilter": "urn:altinn:resource:super-simple-service" 22 | } 23 | } 24 | 25 | settings { 26 | encodeUrl: true 27 | } 28 | 29 | docs { 30 | Requires information about endpoint to post events for subscribers. 31 | } 32 | -------------------------------------------------------------------------------- /Altinn Platform/Authentication/SystemUserToken.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: SystemUserToken 3 | type: http 4 | seq: 4 5 | } 6 | 7 | get { 8 | url: https://altinn-testtools-token-generator.azurewebsites.net/api/GetSystemUserToken?env=tt02&scopes=digdir:dialogporten&systemUserId=aaa88f01-d847-2973-9579-76f658b42caa&systemUserOrg=999888777 9 | body: none 10 | auth: basic 11 | } 12 | 13 | params:query { 14 | env: tt02 15 | scopes: digdir:dialogporten 16 | systemUserId: aaa88f01-d847-2973-9579-76f658b42caa 17 | systemUserOrg: 999888777 18 | } 19 | 20 | auth:basic { 21 | username: {{process.env.TokenGeneratorUserName}} 22 | password: {{process.env.TokenGeneratorPassword}} 23 | } 24 | 25 | settings { 26 | encodeUrl: true 27 | } 28 | -------------------------------------------------------------------------------- /Altinn Platform/Authentication/IDPortenToken.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: IDPortenToken 3 | type: http 4 | seq: 3 5 | } 6 | 7 | get { 8 | url: https://altinn-testtools-token-generator.azurewebsites.net/api/GetPersonalToken?org=digdir&partyId=50018133&env=at23&scopes=digdir:dialogporten&pid=14886498226&ttl=86400&orgNo=991825827 9 | body: none 10 | auth: basic 11 | } 12 | 13 | params:query { 14 | org: digdir 15 | partyId: 50018133 16 | env: at23 17 | scopes: digdir:dialogporten 18 | pid: 14886498226 19 | ttl: 86400 20 | orgNo: 991825827 21 | } 22 | 23 | auth:basic { 24 | username: {{process.env.TokenGeneratorUserName}} 25 | password: {{process.env.TokenGeneratorPassword}} 26 | } 27 | 28 | settings { 29 | encodeUrl: true 30 | } 31 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Instances/datavalues/Updates the data values on an instance.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Updates the data values on an instance. 3 | type: http 4 | seq: 1 5 | } 6 | 7 | put { 8 | url: {{baseUrlPlatform}}/storage/api/v1/instances/:instanceOwnerPartyId/:instanceGuid/datavalues 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | instanceOwnerPartyId: {{PARTYID}} 15 | instanceGuid: {{INSTANCEID}} 16 | } 17 | 18 | headers { 19 | Content-Type: application/json 20 | Accept: application/json 21 | Ocp-Apim-Subscription-Key: {{SubscriptionKey}} 22 | } 23 | 24 | body:json { 25 | { 26 | "values": { 27 | "foo": "bar" 28 | } 29 | } 30 | } 31 | 32 | settings { 33 | encodeUrl: true 34 | } 35 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogActivities/Create activity.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Create activity 3 | type: http 4 | seq: 1 5 | } 6 | 7 | post { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId/activities 9 | body: json 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: 0194ff01-be5a-749a-9917-b0d3b228c4d5 15 | } 16 | 17 | headers { 18 | Content-Type: application/json 19 | Accept: text/plain 20 | } 21 | 22 | body:json { 23 | { 24 | "type": "Information", 25 | "performedBy": { 26 | "actorType": "serviceOwner" 27 | }, 28 | "description": [ 29 | { 30 | "value": "more new", 31 | "languageCode": "nb" 32 | } 33 | ] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogSystemLabel/Bulk set.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Bulk set 3 | type: http 4 | seq: 1 5 | } 6 | 7 | post { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/endusercontext/systemlabels/actions/bulkset?enduserid=urn:altinn:person:identifier-no:08895699684 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | enduserid: urn:altinn:person:identifier-no:08895699684 15 | } 16 | 17 | body:json { 18 | { 19 | "systemLabels": ["Bin"], 20 | "dialogs": [ 21 | { "dialogId": "0196f8bb-7337-7669-a78e-7106f4fd82af" }, 22 | { "dialogId": "0196f8bb-7336-73ae-b22b-b6638c48f7dd" }, 23 | { "dialogId": "0196f8bb-7336-73ae-b139-48707cb72b01"} 24 | ] 25 | } 26 | } 27 | 28 | settings { 29 | encodeUrl: true 30 | } 31 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/Dialogs/List Dialogs.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: List Dialogs 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrl}}/api/v1/enduser/dialogs?Party=urn:altinn:person:identifier-no:08895699684 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | Party: urn:altinn:person:identifier-no:08895699684 15 | ~Party: urn:altinn:person:identifier-no:20815497741 16 | ~CreatedAfter: 2025-02-25T16:04:09.159Z 17 | ~CreatedBefore: 2025-02-27T16:04:09.159Z 18 | ~Party: urn:altinn:person:identifier-no:14886498226 19 | ~ServiceResource: urn:altinn:resource:ttd-dialogporten-performance-test-01 20 | ~continuationToken: createdat_2023-11-03T12:07:53.5292010Z,id_15958b01-b927-da71-bf47-6702a00eb91b 21 | ~Party: urn:altinn:organization:identifier-no:910955489 22 | } 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Environment files with sensitive data 2 | .env 3 | .env.local 4 | .env.production 5 | .env.staging 6 | .env.test 7 | 8 | # Bruno specific files that might contain sensitive data 9 | *.bru.bak 10 | *.bru.tmp 11 | 12 | # OS generated files 13 | .DS_Store 14 | .DS_Store? 15 | ._* 16 | .Spotlight-V100 17 | .Trashes 18 | ehthumbs.db 19 | Thumbs.db 20 | 21 | # IDE files 22 | .vscode/ 23 | .idea/ 24 | *.swp 25 | *.swo 26 | *~ 27 | 28 | # Logs 29 | *.log 30 | logs/ 31 | 32 | # Temporary files 33 | *.tmp 34 | *.temp 35 | 36 | # Node modules (if any) 37 | node_modules/ 38 | 39 | # Test results 40 | test-results/ 41 | results.html 42 | 43 | # Cache files 44 | .cache/ 45 | *.cache 46 | 47 | # Backup files 48 | *.backup 49 | *.bak 50 | 51 | # Local configuration files 52 | config.local.* 53 | settings.local.* -------------------------------------------------------------------------------- /Altinn Platform/Events/subscriptions/subscription for person/Register an subscription for events.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Register an subscription for events 3 | type: http 4 | seq: 1 5 | } 6 | 7 | post { 8 | url: {{baseUrlPlatform}}/events/api/v1/subscriptions 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | headers { 14 | Content-Type: application/json 15 | Accept: application/json 16 | } 17 | 18 | body:json { 19 | { 20 | "endpoint": "https://webhook.site/6df50a9b-d2ba-4839-9970-c69eef484c9f?personal=14886498226", 21 | "subjectFilter": "urn:altinn:organization:identifier-no:212475912", 22 | "resourceFilter": "urn:altinn:resource:super-simple-service" 23 | } 24 | } 25 | 26 | settings { 27 | encodeUrl: true 28 | } 29 | 30 | docs { 31 | Requires information about endpoint to post events for subscribers. 32 | } 33 | -------------------------------------------------------------------------------- /Altinn Platform/Authentication/EnterpriseToken.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: EnterpriseToken 3 | type: http 4 | seq: 2 5 | } 6 | 7 | get { 8 | url: https://altinn-testtools-token-generator.azurewebsites.net/api/GetEnterpriseToken?org=digdir&env=tt02&scopes=digdir:dialogporten.serviceprovider digdir:dialogporten.serviceprovider.search digdir:dialogporten digdir:dialogporten.developer.test&ttl=86400 9 | body: none 10 | auth: basic 11 | } 12 | 13 | params:query { 14 | org: digdir 15 | env: tt02 16 | scopes: digdir:dialogporten.serviceprovider digdir:dialogporten.serviceprovider.search digdir:dialogporten digdir:dialogporten.developer.test 17 | ttl: 86400 18 | ~partyId: 0 19 | ~orgNo: 991825827 20 | } 21 | 22 | auth:basic { 23 | username: {{process.env.TokenGeneratorUserName}} 24 | password: {{process.env.TokenGeneratorPassword}} 25 | } 26 | 27 | settings { 28 | encodeUrl: true 29 | } 30 | -------------------------------------------------------------------------------- /Altinn Platform/Events/Endpoint for posting a new cloud event.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Endpoint for posting a new cloud event 3 | type: http 4 | seq: 4 5 | } 6 | 7 | post { 8 | url: {{baseUrlPlatform}}/events/api/v1/events 9 | body: json 10 | auth: none 11 | } 12 | 13 | headers { 14 | Content-Type: application/cloudevents+json 15 | } 16 | 17 | body:json { 18 | { 19 | "id": "{{$guid}}", 20 | "source": "https://dialogporten.no/api/v1/dialogs/ffffffff-7738-4a51-b9f8-b44b2fca94ee", 21 | "specversion": "1.0", 22 | "type": "dialogporten.dialog.created.v1", 23 | "subject": "urn:altinn:organization:identifier-no:212475912", 24 | "time": "{{$isoTimestamp}}", 25 | "resource": "urn:altinn:resource:super-simple-service", 26 | "data": { 27 | "foo": "test with two subs (now with subject)" 28 | } 29 | } 30 | } 31 | 32 | settings { 33 | encodeUrl: true 34 | } 35 | -------------------------------------------------------------------------------- /example.env: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # AUTHENTICATION CREDENTIALS (REQUIRED) 3 | # ============================================================================= 4 | 5 | # Token Generator Credentials 6 | TokenGeneratorUserName=your_token_generator_username 7 | TokenGeneratorPassword=your_token_generator_password 8 | 9 | # ============================================================================= 10 | # API KEYS AND SUBSCRIPTION KEYS 11 | # ============================================================================= 12 | 13 | # Test Environment Subscription Key 14 | SubKey_TT02=your_tt02_subscription_key 15 | 16 | # AT23 Environment Subscription Key 17 | SubKey_AT23=your_at23_subscription_key 18 | 19 | # Performance testing Environment Subscription Key 20 | SubKey_YT01=your_yt01_subscription_key 21 | 22 | # Production Environment Subscription Key 23 | SubKey_PROD=your_prod_subscription_key 24 | 25 | # Storage Api Key 26 | Sbl_Access_ApiKey=your_storage_api_key 27 | 28 | # App Api Key 29 | App_Access_ApiKey=your_app_api_key -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Altinn 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Dialogporten/EndUser/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: EndUser 3 | } 4 | 5 | script:pre-request { 6 | const altinn = new Altinn(req); 7 | 8 | await (new Altinn(req)).Authenticate({ 9 | /* */ 10 | //"pid": "24885699770", 11 | //"pid": "02834699772", 12 | //"pid": "14886498226", 13 | //"pid": "26849798595", 14 | //"pid": "04816296787", 15 | //"pid": "20855496837", 16 | "pid": "08895699684", 17 | //"pid": "24267200145", // ROMANTISK DRÅPE 18 | "tokenType": "person", 19 | /**/ 20 | 21 | /* 22 | // Legacy enterprise user 23 | "tokenType": "enterpriseuser", 24 | "orgNo": "974760673", 25 | "userName": "something", 26 | "partyId": "51198414", // ORDINÆR HJELPELINJE 27 | "userId": "1263321", // ORDINÆR HJELPELINJE 28 | /**/ 29 | 30 | 31 | // System user 32 | // "tokenType": "systemuser", 33 | // "systemUserId": "e3b87b08-dce6-4edd-8308-db887950a83b", 34 | // "systemUserOrg": "912345678", 35 | 36 | 37 | "scopes": "digdir:dialogporten" 38 | 39 | }); 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Altinn Platform/Events/events/Retrieves a set of events related based on query parameters.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Retrieves a set of events related based on query parameters. 3 | type: http 4 | seq: 1 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/events/api/v1/events?after=0&resource=urn:altinn:resource:dodsbo.domstoladmin.api 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | after: 0 15 | resource: urn:altinn:resource:dodsbo.domstoladmin.api 16 | ~after: b4095c4f-26b7-4e43-810f-8fda385399e4 17 | ~source: https://dialogporten.no/api/v1/dialogs% 18 | ~subject: al 19 | ~type: instance.created 20 | ~type: instance.process.completed 21 | ~size: 50 22 | ~resource: urn:altinn:resource:super-simple-service 23 | ~source: https://dialogporten.no/api/v1/dialogs/018a73cd-2b78-7182-a611-f581c6bef60d 24 | ~after: 3acb53c2-eeee-4572-905c-a84e26131708 25 | ~source: https://hendelsesliste.test.domstol.no/api/objects/c2a4a89d-f3e6-4654-8eef-230eca67d431 26 | } 27 | 28 | headers { 29 | Accept: application/cloudevents+json 30 | ~Altinn-AlternativeSubject: /org/991825827 31 | } 32 | 33 | settings { 34 | encodeUrl: true 35 | } 36 | -------------------------------------------------------------------------------- /Altinn Platform/Events/events/Retrieves a set of events related based on query parameters. Copy.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Retrieves a set of events related based on query parameters. Copy 3 | type: http 4 | seq: 5 5 | } 6 | 7 | get { 8 | url: {{baseUrlPlatform}}/events/api/v1/events?after=0&resource=urn:altinn:resource:super-simple-service 9 | body: none 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | after: 0 15 | resource: urn:altinn:resource:super-simple-service 16 | ~after: b4095c4f-26b7-4e43-810f-8fda385399e4 17 | ~source: https://dialogporten.no/api/v1/dialogs% 18 | ~subject: al 19 | ~type: instance.created 20 | ~type: instance.process.completed 21 | ~size: 50 22 | ~resource: urn:altinn:resource:super-simple-service 23 | ~source: https://dialogporten.no/api/v1/dialogs/018a73cd-2b78-7182-a611-f581c6bef60d 24 | ~after: 3acb53c2-eeee-4572-905c-a84e26131708 25 | ~resource: urn:altinn:resource:dodsbo.domstoladmin.api 26 | ~source: https://hendelsesliste.test.domstol.no/api/objects/c2a4a89d-f3e6-4654-8eef-230eca67d431 27 | } 28 | 29 | headers { 30 | Accept: application/cloudevents+json 31 | ~Altinn-AlternativeSubject: /org/991825827 32 | } 33 | 34 | settings { 35 | encodeUrl: true 36 | } 37 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/Create minimal dialog.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Create minimal dialog 3 | type: http 4 | seq: 2 5 | } 6 | 7 | post { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs 9 | body: json 10 | auth: none 11 | } 12 | 13 | headers { 14 | Content-Type: application/json 15 | Accept: text/plain 16 | } 17 | 18 | body:json { 19 | { 20 | "serviceResource": "urn:altinn:resource:super-simple-service", 21 | "party": "{{PARTY_PERSON}}", 22 | "status": "New", 23 | "progress": 10, 24 | "content": { 25 | "title": { 26 | "value": [ 27 | { 28 | "languageCode": "nb", 29 | "value": "VassenDialog" 30 | }, 31 | { 32 | "languageCode": "en", 33 | "value": "VassenDialog" 34 | } 35 | ] 36 | }, 37 | "summary": { 38 | "value": [ 39 | { 40 | "languageCode": "nb", 41 | "value": "Et sammendrag her. Maks 200 tegn, ingen HTML-støtte. Påkrevd. Vises i liste." 42 | }, 43 | { 44 | "languageCode": "en", 45 | "value": "A summary here. Max 200 characters, no HTML support. Required. Displayed in list." 46 | } 47 | ] 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/DialogTransmissions/Create transmission.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Create transmission 3 | type: http 4 | seq: 3 5 | } 6 | 7 | post { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId/transmissions 9 | body: json 10 | auth: none 11 | } 12 | 13 | params:path { 14 | dialogId: a1f99001-ed97-f176-b3d9-f4d04847b140 15 | } 16 | 17 | headers { 18 | Content-Type: application/json 19 | Accept: text/plain 20 | } 21 | 22 | body:json { 23 | { 24 | "type": "Information", 25 | "sender": { 26 | "actorType": "serviceOwner" 27 | }, 28 | "attachments": [ 29 | { 30 | "displayName": [ 31 | { 32 | "languageCode": "en", 33 | "value": "🦅 USA! USA! USA! 🦅" 34 | } 35 | ], 36 | "urls": [ 37 | { 38 | "url": "https://digdir.apps.tt02.altinn.no/some-other-url", 39 | "consumerType": "Gui" 40 | } 41 | ] 42 | } 43 | ], 44 | "content": { 45 | "title": { 46 | "value": [ 47 | { 48 | "languageCode": "nn", 49 | "value": "🫎 NOREG! NOREG! NOREG! 🫎" 50 | }, 51 | { 52 | "languageCode": "en", 53 | "value": "🦅 USA! USA! USA! 🦅" 54 | } 55 | ] 56 | }, 57 | "summary": { 58 | "value": [ 59 | { 60 | "languageCode": "en", 61 | "value": "🦅 USA! USA! USA! 🦅" 62 | } 63 | ] 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Altinn Platform/ResourceRegistry/Update resource.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Update resource 3 | type: http 4 | seq: 4 5 | } 6 | 7 | put { 8 | url: {{baseUrlPlatform}}/resourceregistry/api/v1/resource/:id 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | id: super-simple-service 15 | } 16 | 17 | body:json { 18 | { 19 | "identifier": "super-simple-service", 20 | "title": { 21 | "en": "Testing resource for Dialogporten", 22 | "nb-no": "Testressurs for Dialogporten", 23 | "nn-no": "Testressurs for Dialogporten" 24 | }, 25 | "description": { 26 | "en": "Testing resource for Dialogporten", 27 | "nb-no": "Testressurs for Dialogporten", 28 | "nn-no": "Testressurs for Dialogporten" 29 | }, 30 | "rightDescription": { 31 | "en": "Testing resource for Dialogporten", 32 | "nb-no": "Testressurs for Dialogporten", 33 | "nn-no": "Testressurs for Dialogporten" 34 | }, 35 | "homepage": "https://digdir.github.io/dialogporten/", 36 | "status": "Active", 37 | "validFrom": "2023-03-27T12:00:00Z", 38 | "validTo": "2099-12-24T23:59:59", 39 | "isPartOf": "Altinn", 40 | "isPublicService": false, 41 | "thematicArea": "", 42 | "resourceReferences": [], 43 | "isComplete": true, 44 | "delegable": false, 45 | "visible": false, 46 | "hasCompetentAuthority": { 47 | "organization": "991825827", 48 | "orgcode": "Digitaliseringsdirektoratet", 49 | "name": { 50 | "en": "Digitaliseringsdirektoratet", 51 | "nb-no": "Digitaliseringsdirektoratet", 52 | "nn-no": "Digitaliseringsdirektoratet" 53 | } 54 | }, 55 | "keywords": [], 56 | "sector": [ 57 | "public" 58 | ], 59 | "resourceType": "GenericAccessResource", 60 | "mainLanguage": "nb" 61 | } 62 | } 63 | 64 | settings { 65 | encodeUrl: true 66 | } 67 | -------------------------------------------------------------------------------- /Altinn Platform/ResourceRegistry/Create Resource.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Create Resource 3 | type: http 4 | seq: 1 5 | } 6 | 7 | post { 8 | url: {{baseUrlPlatform}}/resourceregistry/api/v1/resource 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | params:query { 14 | ~ResourceType: SystemResource 15 | } 16 | 17 | body:json { 18 | { 19 | "identifier": "super-simple-service", 20 | "title": { 21 | "en": "Testing resource for Dialogporten", 22 | "nb-no": "Testressurs for Dialogporten", 23 | "nn-no": "Testressurs for Dialogporten" 24 | }, 25 | "description": { 26 | "en": "Testing resource for Dialogporten", 27 | "nb-no": "Testressurs for Dialogporten", 28 | "nn-no": "Testressurs for Dialogporten" 29 | }, 30 | "rightDescription": { 31 | "en": "Testing resource for Dialogporten", 32 | "nb-no": "Testressurs for Dialogporten", 33 | "nn-no": "Testressurs for Dialogporten" 34 | }, 35 | "homepage": "https://digdir.github.io/dialogporten/", 36 | "status": "Active", 37 | "validFrom": "2023-03-27T12:00:00Z", 38 | "validTo": "2099-12-24T23:59:59", 39 | "isPartOf": "Altinn", 40 | "isPublicService": false, 41 | "thematicArea": "", 42 | "resourceReferences": [], 43 | "isComplete": true, 44 | "delegable": false, 45 | "visible": false, 46 | "hasCompetentAuthority": { 47 | "organization": "991825827", 48 | "orgcode": "Digitaliseringsdirektoratet", 49 | "name": { 50 | "en": "Digitaliseringsdirektoratet", 51 | "nb-no": "Digitaliseringsdirektoratet", 52 | "nn-no": "Digitaliseringsdirektoratet" 53 | } 54 | }, 55 | "keywords": [], 56 | "sector": [ 57 | "public" 58 | ], 59 | "resourceType": "GenericAccessResource", 60 | "mainLanguage": "nb" 61 | } 62 | } 63 | 64 | settings { 65 | encodeUrl: true 66 | } 67 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Instances/folder.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Instances 3 | seq: 1 4 | } 5 | 6 | auth { 7 | mode: inherit 8 | } 9 | 10 | script:pre-request { 11 | (new Altinn(pm)).Authenticate({ 12 | "tokenType": "enterprise", 13 | //"orgNo": "991825827", // Digdir/TTD 14 | //"orgNo": "974760983", 15 | //"org": "dsb", 16 | "orgNo": "880455702", 17 | "org": "tad", 18 | // "org": "ssb", 19 | "scopes": "altinn:serviceowner/instances.read altinn:storage/instances.syncadapter" 20 | }); 21 | 22 | 23 | // //pm.collectionVariables.set("PARTYID", "50013832"); 24 | // //pm.collectionVariables.set("INSTANCEID", "acf2ae04-6e27-49a4-81c5-a6877d191645"); 25 | 26 | // // pm.collectionVariables.set("PARTYID", "50055202"); 27 | // // pm.collectionVariables.set("INSTANCEID", "b251a497-ec6c-4269-862c-32d8a9de6884"); 28 | 29 | 30 | // TTD 31 | // // pm.collectionVariables.set("PARTYID", "50126876"); 32 | // // pm.collectionVariables.set("INSTANCEID", "7eac5837-ce4c-42fc-a1d8-3bb85540b14e"); 33 | 34 | 35 | // SSB 36 | // // pm.collectionVariables.set("PARTYID", "50168990"); 37 | // // pm.collectionVariables.set("INSTANCEID", "a1d4101a-65fa-44bc-b93c-3b272814874b"); 38 | 39 | 40 | // //pm.collectionVariables.set("PARTYID", "50892513"); 41 | // //pm.collectionVariables.set("INSTANCEID", "8b308675-9fbe-4d6c-aa80-392a72aafed8"); 42 | 43 | bru.setVar("PARTYID", "50923188"); 44 | // //pm.collectionVariables.set("INSTANCEID", "f75f9004-6949-4cdd-9039-0c593edba9ca"); 45 | bru.setVar("INSTANCEID", "3217ad00-4218-47c4-9cec-1749ae5df3d3"); 46 | 47 | //50923188/f75f9004-6949-4cdd-9039-0c593edba9ca 48 | 49 | // Sirius 50 | bru.setVar("PARTYID", "51536437"); 51 | // //pm.collectionVariables.set("INSTANCEID", "f75f9004-6949-4cdd-9039-0c593edba9ca"); 52 | bru.setVar("INSTANCEID", "d6ae1681-b2e9-4f4a-9aca-2cd321a8cb36"); 53 | 54 | // KRI prefill 55 | bru.setVar("PARTYID", "51701090"); 56 | bru.setVar("INSTANCEID", "0dbc1da6-f744-4fff-83bc-131e7988a1bb"); 57 | 58 | 59 | bru.setVar("SBLACCESS_APIKEY", process.env.Sbl_Access_ApiKey); 60 | bru.setVar("APPACCESS_APIKEY", process.env.App_Access_ApiKey); 61 | 62 | // Pågående sak hos Tolletaten 63 | bru.setVar("PARTYID", "50759986"); 64 | bru.setVar("INSTANCEID", "26a7cdaf-4b1b-41f5-81a1-3ab1231ff895"); 65 | 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dialogporten Bruno Collection 2 | 3 | A comprehensive API testing collection for the Dialogporten platform, part of the Altinn ecosystem. 4 | 5 | ## Getting Started 6 | 7 | To get up and running, you need to: 8 | 9 | ### 1. Install Bruno 10 | 11 | Bruno is an open-source API client for exploring and testing APIs. You can install it using one of the following methods: 12 | 13 | #### macOS 14 | - **Direct Download**: Download from the [official downloads page](https://www.usebruno.com/downloads) 15 | - **Homebrew**: `brew install bruno` 16 | 17 | #### Windows 18 | - **Direct Download**: Download the Windows installer from the [official downloads page](https://www.usebruno.com/downloads) 19 | - **Package Managers**: 20 | - Chocolatey: `choco install bruno` 21 | - Winget: `winget install Bruno.Bruno` 22 | - Scoop: `scoop install bruno` 23 | 24 | #### Linux 25 | - **Direct Download**: Download the Linux package from the [official downloads page](https://www.usebruno.com/downloads) 26 | - **Package Managers**: 27 | - Debian/Ubuntu: Follow the [official installation guide](https://docs.usebruno.com/get-started/bruno-basics/download) 28 | - Flatpak: `flatpak install flathub com.usebruno.Bruno` 29 | - Snap: `sudo snap install bruno` 30 | 31 | ### 2. Open the Collection 32 | 33 | Once Bruno is installed: 34 | 35 | 1. **Open Bruno** on your system 36 | 2. **Click "Open Collection"** from the home screen 37 | 3. **Navigate to this folder** (`dialogporten-bruno`) and select it 38 | 4. The collection will load with all the organized requests and environments 39 | 40 | ### 3. Configure Environment Variables 41 | 42 | 1. **Create your own `.env` file** based on the included `example.env` file. 43 | ```bash 44 | cp example.env .env 45 | ``` 46 | 47 | 2. **Edit the `.env` file** with your actual credentials and configuration values: 48 | ```bash 49 | # Open .env in your preferred text editor 50 | # Replace placeholder values with your real credentials 51 | # Example: API_KEY=your_actual_api_key_here 52 | ``` 53 | 54 | 3. **Select an environment** from the dropdown in Bruno (e.g., "Local development", "Staging", "Production") 55 | 4. **Update environment variables** as needed for your specific setup 56 | 57 | ## Collection Structure 58 | 59 | This collection is organized into two main sections: 60 | 61 | - **EndUser**: API endpoints for end users interacting with dialogs 62 | - **ServiceOwner**: API endpoints for service owners managing dialogs and activities 63 | 64 | Each section contains organized folders for different resource types (Dialogs, DialogActivities, etc.) with corresponding API requests. -------------------------------------------------------------------------------- /Altinn Platform/Authorization (external)/Decision/authorize.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: authorize 3 | type: http 4 | seq: 1 5 | } 6 | 7 | post { 8 | url: {{baseUrlPlatform}}/authorization/api/v1/authorize 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | headers { 14 | Ocp-Apim-Subscription-Key: {{SubscriptionKey}} 15 | } 16 | 17 | body:json { 18 | { 19 | "Request": { 20 | "Resource": [ 21 | { 22 | "Id": "r1", 23 | "Attribute": [ 24 | { 25 | "AttributeId": "urn:altinn:resource", 26 | "Value": "super-simple-service" 27 | }, 28 | { 29 | "AttributeId": "urn:altinn:organization:identifier-no", 30 | "Value": "212475912" 31 | } 32 | ] 33 | }, 34 | { 35 | "Id": "r2", 36 | "Attribute": [ 37 | { 38 | "AttributeId": "urn:altinn:resource", 39 | "Value": "super-simple-service" 40 | }, 41 | { 42 | "AttributeId": "urn:altinn:person:identifier-no", 43 | "Value": "14886498226" 44 | } 45 | ] 46 | } 47 | ], 48 | "Action": [ 49 | { 50 | "Id": "a1", 51 | "Attribute": [ 52 | { 53 | "AttributeId": "urn:oasis:names:tc:xacml:1.0:action:action-id", 54 | "Value": "subscribe" 55 | } 56 | ] 57 | } 58 | ], 59 | "AccessSubject": [ 60 | { 61 | "Id": "s1", 62 | "Attribute": [ 63 | { 64 | "AttributeId": "urn:altinn:person:identifier-no", 65 | "Value": "14886498226" 66 | } 67 | ] 68 | } 69 | ], 70 | "MultiRequests": { 71 | "RequestReference": [ 72 | { 73 | "ReferenceId": [ 74 | "s1", 75 | "r1", 76 | "a1" 77 | ] 78 | }, 79 | { 80 | "ReferenceId": [ 81 | "s1", 82 | "r1", 83 | "a1" 84 | ] 85 | } 86 | ] 87 | } 88 | } 89 | } 90 | } 91 | 92 | settings { 93 | encodeUrl: true 94 | } 95 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Applications/Set text resource for a single app.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Set text resource for a single app 3 | type: http 4 | seq: 5 5 | } 6 | 7 | post { 8 | url: {{baseUrlPlatform}}/storage/api/v1/applications/:org/:app/texts/ 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | org: ttd 15 | app: testdriver-for-arbeidsflate 16 | } 17 | 18 | headers { 19 | Accept: application/json 20 | Ocp-Apim-Subscription-Key: {{SubscriptionKey}} 21 | } 22 | 23 | body:json { 24 | { 25 | "id": "ttd-testdriver-for-arbeidsflate-nb", 26 | "org": "ttd", 27 | "language": "nb", 28 | "resources": [ 29 | { 30 | "id": "dp.title", 31 | "value": "Testdriver for Arbeidsflate - TE-oppgitt tittel", 32 | "variables": null 33 | }, 34 | { 35 | "id": "Side1.Input-2RCDMG.title", 36 | "value": "Bekreft type:", 37 | "variables": null 38 | }, 39 | { 40 | "id": "Forsiden.RadioButtons-K7RXo2.help", 41 | "value": "Dette for at vi enklere skal kunne gi deg rådgivning basert på din situasjon.", 42 | "variables": null 43 | }, 44 | { 45 | "id": "Forsiden.RadioButtons-K7RXo2.description", 46 | "value": "", 47 | "variables": null 48 | }, 49 | { 50 | "id": "Forsiden.RadioButtons-K7RXo2.title", 51 | "value": "Hvilke av disse observerer du oftest?", 52 | "variables": null 53 | }, 54 | { 55 | "id": "Skjemasiden.TextArea-Jtmm3x.title", 56 | "value": "Gi en nærmere beskrivelse av observasjonen:", 57 | "variables": null 58 | }, 59 | { 60 | "id": "Skjemasiden.Dropdown-Ra6M3D.title", 61 | "value": "Hvilken type troll observerte du?", 62 | "variables": null 63 | }, 64 | { 65 | "id": "Skjemasiden.Input-HPSPn2.title", 66 | "value": "Hvorfor besøker du denne siden?", 67 | "variables": null 68 | }, 69 | { 70 | "id": "Skjemasiden.Button-o5RORh.title", 71 | "value": "Send inn", 72 | "variables": null 73 | }, 74 | { 75 | "id": "Skjemasiden.Input-Kl2gyP.title", 76 | "value": "Hva heter du?", 77 | "variables": null 78 | }, 79 | { 80 | "id": "Skjemasiden.Input-6Q2mnb.title", 81 | "value": "Hva er ditt ønske?", 82 | "variables": null 83 | }, 84 | { 85 | "id": "Side1.Paragraph-8z4Sft.title", 86 | "value": "Med dette skjemaet kan du frembringe dialoger i arbeidsflaten og oppdatere status på disse.", 87 | "variables": null 88 | }, 89 | { 90 | "id": "appName", 91 | "value": "Testdriver for Arbeidsflate", 92 | "variables": null 93 | }, 94 | { 95 | "id": "next", 96 | "value": "Neste", 97 | "variables": null 98 | }, 99 | { 100 | "id": "back", 101 | "value": "Forrige", 102 | "variables": null 103 | } 104 | ] 105 | } 106 | } 107 | 108 | settings { 109 | encodeUrl: true 110 | } 111 | -------------------------------------------------------------------------------- /Altinn Platform/Storage/Applications/update metadata for a single app.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: update metadata for a single app 3 | type: http 4 | seq: 3 5 | } 6 | 7 | put { 8 | url: {{baseUrlPlatform}}/storage/api/v1/applications/:org/:app 9 | body: json 10 | auth: inherit 11 | } 12 | 13 | params:path { 14 | org: ttd 15 | app: storage-end-to-end 16 | } 17 | 18 | headers { 19 | Accept: application/json 20 | Ocp-Apim-Subscription-Key: {{SubscriptionKey}} 21 | } 22 | 23 | body:json { 24 | { 25 | "id": "ttd/storage-end-to-end", 26 | "versionId": "9bab67b31aaa78f9a64bd32c182c316ffbb1f1c7", 27 | "org": "ttd", 28 | "title": { 29 | "nb": "storage-end-to-end" 30 | }, 31 | "validFrom": "2025-04-24T11:28:41.3784895Z", 32 | "dataTypes": [ 33 | { 34 | "id": "ref-data-as-pdf", 35 | "allowedContentTypes": [ 36 | "application/pdf" 37 | ], 38 | "maxCount": 0, 39 | "minCount": 0, 40 | "enablePdfCreation": true, 41 | "enableFileScan": false, 42 | "validationErrorOnPendingFileScan": false, 43 | "enabledFileAnalysers": [], 44 | "enabledFileValidators": [] 45 | }, 46 | { 47 | "id": "correspondence", 48 | "allowedContentTypes": [ 49 | "application/xml" 50 | ], 51 | "appLogic": { 52 | "autoCreate": true, 53 | "classRef": "Altinn.App.Models.CorrespondenceV1", 54 | "allowAnonymousOnStateless": false, 55 | "autoDeleteOnProcessEnd": false, 56 | "disallowUserCreate": false, 57 | "disallowUserDelete": false, 58 | "allowInSubform": false 59 | }, 60 | "taskId": "Task_1", 61 | "maxCount": 1, 62 | "minCount": 1, 63 | "enablePdfCreation": true, 64 | "enableFileScan": false, 65 | "validationErrorOnPendingFileScan": false, 66 | "enabledFileAnalysers": [], 67 | "enabledFileValidators": [] 68 | }, 69 | { 70 | "id": "signature", 71 | "allowedContentTypes": [ 72 | "application/json" 73 | ], 74 | "taskId": "Task_2", 75 | "maxSize": 25, 76 | "maxCount": 1, 77 | "minCount": 0, 78 | "enablePdfCreation": true, 79 | "enableFileScan": false, 80 | "validationErrorOnPendingFileScan": false, 81 | "enabledFileAnalysers": [], 82 | "enabledFileValidators": [] 83 | }, 84 | { 85 | "id": "attachment", 86 | "allowedContentTypes": [], 87 | "taskId": "Task_1", 88 | "maxSize": 25, 89 | "maxCount": 25, 90 | "minCount": 1, 91 | "enablePdfCreation": true, 92 | "enableFileScan": false, 93 | "validationErrorOnPendingFileScan": false, 94 | "enabledFileAnalysers": [], 95 | "enabledFileValidators": [] 96 | } 97 | ], 98 | "messageBoxConfig": { 99 | "syncAdapterSettings": { 100 | "disableSync": false, 101 | "disableCreate": false, 102 | "disableDelete": false, 103 | "disableAddActivities": false, 104 | "disableAddTransmissions": false, 105 | "disableSyncDueAt": false, 106 | "disableSyncStatus": false, 107 | "disableSyncContentTitle": false, 108 | "disableSyncContentSummary": false, 109 | "disableSyncAttachments": false, 110 | "disableSyncApiActions": false, 111 | "disableSyncGuiActions": false 112 | } 113 | }, 114 | "partyTypesAllowed": { 115 | "bankruptcyEstate": false, 116 | "organisation": false, 117 | "person": false, 118 | "subUnit": false 119 | }, 120 | "autoDeleteOnProcessEnd": false, 121 | "disallowUserInstantiation": false 122 | } 123 | 124 | } 125 | 126 | settings { 127 | encodeUrl: true 128 | } 129 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/Update dialog.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Update dialog 3 | type: http 4 | seq: 4 5 | } 6 | 7 | put { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs/:dialogId 9 | body: json 10 | auth: none 11 | } 12 | 13 | params:query { 14 | ~process: urn:test:process:2 15 | ~progress: 92 16 | } 17 | 18 | params:path { 19 | dialogId: 0198c6fd-7e4b-7093-871e-0b8340a4fcb9 20 | } 21 | 22 | headers { 23 | Content-Type: application/json 24 | Accept: text/plain 25 | } 26 | 27 | body:json { 28 | { 29 | "id": "01950199-ce68-77e4-8fad-c65ff19b0d5a", 30 | "revision": "c550f92e-c76a-497f-ba26-30edd50032d9", 31 | "org": "nav", 32 | "serviceResource": "urn:altinn:resource:nav_tiltaksarrangor_deltakeroversikt-koordinator", 33 | "serviceResourceType": "genericaccessresource", 34 | "party": "urn:altinn:person:identifier-no:08895699684", 35 | "progress": 21, 36 | "createdAt": "2025-02-13T23:16:51.9421070Z", 37 | "updatedAt": "2025-02-13T23:16:51.9421070Z", 38 | "status": "New", 39 | "systemLabel": "Default", 40 | "content": { 41 | "title": { 42 | "value": [ 43 | { 44 | "value": "Sens", 45 | "languageCode": "en" 46 | }, 47 | { 48 | "value": "Sens", 49 | "languageCode": "nb" 50 | } 51 | ], 52 | "mediaType": "text/plain" 53 | }, 54 | "summary": { 55 | "value": [ 56 | { 57 | "value": "A sens summary here. Max 200 characters, no HTML support. Required. Displayed in list.", 58 | "languageCode": "en" 59 | }, 60 | { 61 | "value": "Et sens sammendrag her. Maks 200 tegn, ingen HTML-støtte. Påkrevd. Vises i liste.", 62 | "languageCode": "nb" 63 | } 64 | ], 65 | "mediaType": "text/plain" 66 | }, 67 | "mainContentReference": { 68 | "value": [ 69 | { 70 | "value": "https://nrk.no", 71 | "languageCode": "nb" 72 | } 73 | ], 74 | "mediaType": "application/vnd.dialogporten.frontchannelembed-url;type=text/markdown" 75 | } 76 | }, 77 | "attachments": [ 78 | { 79 | "id": "01950199-ce68-77e4-8fe6-74dd7edf7c5b", 80 | "displayName": [ 81 | { 82 | "value": "Dialog attachment display name", 83 | "languageCode": "en" 84 | }, 85 | { 86 | "value": "Dialogvedlegg visningsnavn", 87 | "languageCode": "nb" 88 | } 89 | ], 90 | "urls": [ 91 | { 92 | "id": "01950199-ce68-77e4-8ff3-3c37cb46faae", 93 | "url": "https://digdir.apps.tt02.altinn.no/some-url", 94 | "mediaType": "foo", 95 | "consumerType": "Gui" 96 | } 97 | ] 98 | } 99 | ], 100 | "guiActions": [ 101 | { 102 | "id": "01950199-ce68-77e4-9068-12068e78010f", 103 | "action": "submit", 104 | "url": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/#/instance/50756302/58d88b01-8840-8771-a6dd-e51e9809df2c", 105 | "isDeleteDialogAction": false, 106 | "priority": "Secondary", 107 | "httpMethod": "GET", 108 | "title": [ 109 | { 110 | "value": "A GUI action titile", 111 | "languageCode": "en" 112 | }, 113 | { 114 | "value": "En GUI-handlings tittel", 115 | "languageCode": "nb" 116 | } 117 | ] 118 | }, 119 | { 120 | "id": "01950199-ce68-77e4-907b-9a514efda284", 121 | "action": "sit", 122 | "url": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/#/instance/50756302/58d88b01-8840-8771-a6dd-e51e9809df2c", 123 | "isDeleteDialogAction": false, 124 | "priority": "Primary", 125 | "httpMethod": "POST", 126 | "title": [ 127 | { 128 | "value": "Go to", 129 | "languageCode": "en" 130 | }, 131 | { 132 | "value": "Gå til innsending", 133 | "languageCode": "nb" 134 | } 135 | ], 136 | "prompt": [ 137 | { 138 | "value": "Are you sure?", 139 | "languageCode": "en" 140 | }, 141 | { 142 | "value": "Er du sikker?", 143 | "languageCode": "nb" 144 | } 145 | ] 146 | } 147 | ], 148 | "apiActions": [ 149 | { 150 | "id": "01950199-ce68-77e4-8fdb-f3f876b45599", 151 | "action": "submit", 152 | "endpoints": [ 153 | { 154 | "id": "01950199-ce68-77e4-8fdc-2b03dcd5c8bf", 155 | "version": "20231015", 156 | "url": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/#/instance/50756302/58d88b01-8840-8771-a6dd-e51e9809df2c/data?dataType=mainform-20231015", 157 | "httpMethod": "POST", 158 | "requestSchema": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/api/jsonschema/mainform-20231015", 159 | "responseSchema": "https://docs.altinn.studio/swagger/altinn-app-v1.json#/components/schemas/DataElement", 160 | "deprecated": false 161 | } 162 | ] 163 | } 164 | ] 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/Create dialog.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: Create dialog 3 | type: http 4 | seq: 1 5 | } 6 | 7 | post { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs 9 | body: json 10 | auth: none 11 | } 12 | 13 | headers { 14 | Content-Type: application/json 15 | Accept: text/plain 16 | } 17 | 18 | body:json { 19 | { 20 | "serviceResource": "urn:altinn:resource:super-simple-service", 21 | "party": "{{PARTY_PERSON}}", 22 | "status": "New", 23 | "progress": 10, 24 | "process": "foo", 25 | "precedingProcess": "bar", 26 | "content": { 27 | "mainContentReference": { 28 | "mediaType": "application/vnd.dialogporten.frontchannelembed+json;type=markdown", 29 | "value": [ 30 | { 31 | "languageCode": "nb", 32 | "value": "https://nrk.no" 33 | } 34 | ] 35 | }, 36 | "title": { 37 | "value": [ 38 | { 39 | "languageCode": "nb", 40 | "value": "VassenDialog" 41 | }, 42 | { 43 | "languageCode": "en", 44 | "value": "VassenDialog" 45 | } 46 | ] 47 | }, 48 | "summary": { 49 | "value": [ 50 | { 51 | "languageCode": "nb", 52 | "value": "Et sammendrag her. Maks 200 tegn, ingen HTML-støtte. Påkrevd. Vises i liste." 53 | }, 54 | { 55 | "languageCode": "en", 56 | "value": "A summary here. Max 200 characters, no HTML support. Required. Displayed in list." 57 | } 58 | ] 59 | } 60 | }, 61 | "transmissions": [ 62 | { 63 | "authorizationAttribute": "not-authorized", 64 | "type": "Information", 65 | "sender": { 66 | "actorType": "serviceOwner" 67 | }, 68 | "attachments": [ 69 | { 70 | "displayName": [ 71 | { 72 | "languageCode": "nb", 73 | "value": "Visningsnavn for forsendelsesvedlegg " 74 | }, 75 | { 76 | "languageCode": "en", 77 | "value": "Transmission attachment display name" 78 | } 79 | ], 80 | "urls": [ 81 | { 82 | "url": "https://digdir.apps.tt02.altinn.no/some-other-url", 83 | "consumerType": "Gui" 84 | } 85 | ] 86 | } 87 | ], 88 | "content": { 89 | "ContentReference": { 90 | "mediaType": "application/vnd.dialogporten.frontchannelembed+json;type=markdown", 91 | "value": [ 92 | { 93 | "languageCode": "nb", 94 | "value": "https://nrk.no" 95 | } 96 | ] 97 | }, 98 | "title": { 99 | "value": [ 100 | { 101 | "languageCode": "nb", 102 | "value": "Forsendelsesstittel" 103 | }, 104 | { 105 | "languageCode": "en", 106 | "value": "Transmission title" 107 | } 108 | ] 109 | }, 110 | "summary": { 111 | "value": [ 112 | { 113 | "languageCode": "nb", 114 | "value": "Transmisjon oppsummering" 115 | }, 116 | { 117 | "languageCode": "en", 118 | "value": "Transmission summary" 119 | } 120 | ] 121 | } 122 | } 123 | }, 124 | { 125 | "type": "Information", 126 | "sender": { 127 | "actorType": "serviceOwner" 128 | }, 129 | "attachments": [ 130 | { 131 | "displayName": [ 132 | { 133 | "languageCode": "nb", 134 | "value": "Visningsnavn for forsendelsesvedlegg" 135 | }, 136 | { 137 | "languageCode": "en", 138 | "value": "Transmission attachment display name" 139 | } 140 | ], 141 | "urls": [ 142 | { 143 | "mediaType": "foo", 144 | "url": "https://digdir.apps.tt02.altinn.no/some-other-url", 145 | "consumerType": "Gui" 146 | } 147 | ] 148 | } 149 | ], 150 | "content": { 151 | "title": { 152 | "value": [ 153 | { 154 | "languageCode": "nb", 155 | "value": "Forsendelsetittel" 156 | }, 157 | { 158 | "languageCode": "en", 159 | "value": "Transmission title" 160 | } 161 | ] 162 | }, 163 | "summary": { 164 | "value": [ 165 | { 166 | "languageCode": "nb", 167 | "value": "Forsendelsesoppsummering" 168 | }, 169 | { 170 | "languageCode": "en", 171 | "value": "Transmission summary" 172 | } 173 | ] 174 | } 175 | } 176 | } 177 | ], 178 | "attachments": [ 179 | { 180 | "displayName": [ 181 | { 182 | "languageCode": "nb", 183 | "value": "Dialogvedlegg visningsnavn" 184 | }, 185 | { 186 | "languageCode": "en", 187 | "value": "Dialog attachment display name" 188 | } 189 | ], 190 | "urls": [ 191 | { 192 | "mediaType": "foo", 193 | "url": "https://digdir.apps.tt02.altinn.no/some-url", 194 | "consumerType": "gui" 195 | } 196 | ] 197 | } 198 | ], 199 | "guiActions": [ 200 | { 201 | "title": [ 202 | { 203 | "value": "En GUI-handlings tittel", 204 | "languageCode": "nb-no" 205 | }, 206 | { 207 | "value": "A GUI action titile", 208 | "languageCode": "en-US" 209 | } 210 | ], 211 | "action": "submit", 212 | "url": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/#/instance/50756302/58d88b01-8840-8771-a6dd-e51e9809df2c", 213 | "priority": "Secondary" 214 | }, 215 | { 216 | "action": "sit", 217 | "url": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/#/instance/50756302/58d88b01-8840-8771-a6dd-e51e9809df2c", 218 | "priority": "Primary", 219 | "httpMethod": "Post", 220 | "title": [ 221 | { 222 | "value": "Gå til innsending", 223 | "languageCode": "nb-no" 224 | }, 225 | { 226 | "value": "Go to", 227 | "languageCode": "en" 228 | } 229 | ], 230 | "prompt": [ 231 | { 232 | "value": "Er du sikker?", 233 | "languageCode": "nb-no" 234 | }, 235 | { 236 | "value": "Are you sure?", 237 | "languageCode": "en_gb" 238 | } 239 | ] 240 | } 241 | ], 242 | "apiActions": [ 243 | { 244 | "action": "submit", 245 | "endpoints": [ 246 | { 247 | "version": "20231015", 248 | "url": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/#/instance/50756302/58d88b01-8840-8771-a6dd-e51e9809df2c/data?dataType=mainform-20231015", 249 | "httpMethod": "POST", 250 | "accepts": [ 251 | "application/json" 252 | ], 253 | "requestSchema": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/api/jsonschema/mainform-20231015", 254 | "responseSchema": "https://docs.altinn.studio/swagger/altinn-app-v1.json#/components/schemas/DataElement" 255 | } 256 | ] 257 | } 258 | ], 259 | "activities": [ 260 | { 261 | "createdAt": "2023-11-16T13:35:44.2268490Z", 262 | "type": "DialogCreated", 263 | "performedBy": { 264 | "actorType": "partyRepresentative", 265 | "actorName": "somename" 266 | } 267 | }, 268 | { 269 | "createdAt": "2023-11-16T13:35:44.2268490Z", 270 | "type": "Information", 271 | "performedBy": { 272 | "actorType": "serviceOwner" 273 | }, 274 | "description": [ 275 | { 276 | "value": "Skjema opprettet og forhåndsutfylt", 277 | "languageCode": "nb" 278 | }, 279 | { 280 | "value": "Form created and pre-filled", 281 | "languageCode": "en" 282 | } 283 | ] 284 | } 285 | ] 286 | } 287 | } 288 | -------------------------------------------------------------------------------- /Dialogporten/ServiceOwner/Dialogs/gql-post-test.bru: -------------------------------------------------------------------------------- 1 | meta { 2 | name: gql-post-test 3 | type: http 4 | seq: 3 5 | } 6 | 7 | post { 8 | url: {{baseUrl}}/api/v1/serviceowner/dialogs 9 | body: json 10 | auth: none 11 | } 12 | 13 | headers { 14 | Content-Type: application/json 15 | Accept: text/plain 16 | } 17 | 18 | body:json { 19 | { 20 | "serviceResource": "urn:altinn:resource:ttd-dialogporten-automated-tests", 21 | "party": "urn:altinn:person:identifier-no:14886498226", 22 | "status": "New", 23 | "progress": 10, 24 | "content": { 25 | "title": { 26 | "value": [ 27 | { 28 | "languageCode": "nb", 29 | "value": "Fin tittel" 30 | }, 31 | { 32 | "languageCode": "en", 33 | "value": "Nice title" 34 | } 35 | ] 36 | }, 37 | "summary": { 38 | "value": [ 39 | { 40 | "languageCode": "nb", 41 | "value": "Et sammendrag her. Maks 200 tegn, ingen HTML-støtte. Påkrevd. Vises i liste." 42 | }, 43 | { 44 | "languageCode": "en", 45 | "value": "A summary here. Max 200 characters, no HTML support. Required. Displayed in list." 46 | } 47 | ] 48 | }, 49 | "additionalInfo": { 50 | "mediaType": "text/markdown", 51 | "value": [ 52 | { 53 | "languageCode": "en", 54 | "value": "Some additional info, *supports* **markdown**" 55 | }, 56 | { 57 | "languageCode": "nb", 58 | "value": "Tillegsinformasjon, *støtter* **markdown**" 59 | } 60 | ] 61 | }, 62 | "mainContentReference": { 63 | "mediaType": "application/vnd.dialogporten.frontchannelembed+json;type=markdown", 64 | "value": [ 65 | { 66 | "languageCode": "nb", 67 | "value": "https://dummy-address.no" 68 | }, 69 | { 70 | "languageCode": "en", 71 | "value": "https://dummy-address.com" 72 | } 73 | ] 74 | } 75 | }, 76 | "transmissions": [ 77 | { 78 | "type": "Information", 79 | "authorizationAttribute": "element1", 80 | "sender": { 81 | "actorType": "serviceOwner" 82 | }, 83 | "attachments": [ 84 | { 85 | "displayName": [ 86 | { 87 | "languageCode": "nb", 88 | "value": "Forsendelse visningsnavn" 89 | }, 90 | { 91 | "languageCode": "en", 92 | "value": "Transmission attachment display name" 93 | } 94 | ], 95 | "urls": [ 96 | { 97 | "url": "https://digdir.apps.tt02.altinn.no/some-other-url", 98 | "consumerType": "Gui" 99 | } 100 | ] 101 | } 102 | ], 103 | "content": { 104 | "title": { 105 | "value": [ 106 | { 107 | "languageCode": "nb", 108 | "value": "Forsendelsestittel" 109 | }, 110 | { 111 | "languageCode": "en", 112 | "value": "Transmission title" 113 | } 114 | ] 115 | }, 116 | "summary": { 117 | "value": [ 118 | { 119 | "languageCode": "nb", 120 | "value": "Forsendelse oppsummering" 121 | }, 122 | { 123 | "languageCode": "en", 124 | "value": "Transmission summary" 125 | } 126 | ] 127 | } 128 | } 129 | }, 130 | { 131 | "type": "Information", 132 | "sender": { 133 | "actorType": "serviceOwner" 134 | }, 135 | "attachments": [ 136 | { 137 | "displayName": [ 138 | { 139 | "languageCode": "nb", 140 | "value": "Visningsnavn for forsendelsesvedlegg " 141 | }, 142 | { 143 | "languageCode": "en", 144 | "value": "Transmission attachment display name" 145 | } 146 | ], 147 | "urls": [ 148 | { 149 | "url": "https://digdir.apps.tt02.altinn.no/some-other-url", 150 | "consumerType": "Gui" 151 | } 152 | ] 153 | } 154 | ], 155 | "content": { 156 | "title": { 157 | "value": [ 158 | { 159 | "languageCode": "nb", 160 | "value": "Forsendelsesstittel" 161 | }, 162 | { 163 | "languageCode": "en", 164 | "value": "Transmission title" 165 | } 166 | ] 167 | }, 168 | "summary": { 169 | "value": [ 170 | { 171 | "languageCode": "nb", 172 | "value": "Transmisjon oppsummering" 173 | }, 174 | { 175 | "languageCode": "en", 176 | "value": "Transmission summary" 177 | } 178 | ] 179 | } 180 | } 181 | }, 182 | { 183 | "type": "Information", 184 | "authorizationAttribute": "elementius", 185 | "sender": { 186 | "actorType": "serviceOwner" 187 | }, 188 | "attachments": [ 189 | { 190 | "displayName": [ 191 | { 192 | "languageCode": "nb", 193 | "value": "Visningsnavn for forsendelsesvedlegg" 194 | }, 195 | { 196 | "languageCode": "en", 197 | "value": "Transmission attachment display name" 198 | } 199 | ], 200 | "urls": [ 201 | { 202 | "url": "https://digdir.apps.tt02.altinn.no/some-other-url", 203 | "consumerType": "Gui" 204 | } 205 | ] 206 | } 207 | ], 208 | "content": { 209 | "title": { 210 | "value": [ 211 | { 212 | "languageCode": "nb", 213 | "value": "Forsendelsetittel" 214 | }, 215 | { 216 | "languageCode": "en", 217 | "value": "Transmission title" 218 | } 219 | ] 220 | }, 221 | "summary": { 222 | "value": [ 223 | { 224 | "languageCode": "nb", 225 | "value": "Forsendelsesoppsummering" 226 | }, 227 | { 228 | "languageCode": "en", 229 | "value": "Transmission summary" 230 | } 231 | ] 232 | } 233 | } 234 | } 235 | ], 236 | "attachments": [ 237 | { 238 | "displayName": [ 239 | { 240 | "languageCode": "nb", 241 | "value": "Dialogvedlegg visningsnavn" 242 | }, 243 | { 244 | "languageCode": "en", 245 | "value": "Dialog attachment display name" 246 | } 247 | ], 248 | "urls": [ 249 | { 250 | "url": "https://digdir.apps.tt02.altinn.no/some-url", 251 | "consumerType": "gui" 252 | } 253 | ] 254 | } 255 | ], 256 | "searchTags": [ 257 | { 258 | "value": "something searchable" 259 | }, 260 | { 261 | "value": "more search" 262 | } 263 | ], 264 | "guiActions": [ 265 | { 266 | "title": [ 267 | { 268 | "value": "En GUI-handlings tittel", 269 | "languageCode": "nb-no" 270 | }, 271 | { 272 | "value": "A GUI action titile", 273 | "languageCode": "en-US" 274 | } 275 | ], 276 | "action": "submit", 277 | "url": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/#/instance/50756302/58d88b01-8840-8771-a6dd-e51e9809df2c", 278 | "priority": "Secondary" 279 | }, 280 | { 281 | "action": "sit", 282 | "url": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/#/instance/50756302/58d88b01-8840-8771-a6dd-e51e9809df2c", 283 | "priority": "Primary", 284 | "httpMethod": "Post", 285 | "title": [ 286 | { 287 | "value": "Gå til innsending", 288 | "languageCode": "nb-no" 289 | }, 290 | { 291 | "value": "Go to", 292 | "languageCode": "en" 293 | } 294 | ], 295 | "prompt": [ 296 | { 297 | "value": "Er du sikker?", 298 | "languageCode": "nb-no" 299 | }, 300 | { 301 | "value": "Are you sure?", 302 | "languageCode": "en_gb" 303 | } 304 | ] 305 | } 306 | ], 307 | "apiActions": [ 308 | { 309 | "action": "submit", 310 | "endpoints": [ 311 | { 312 | "version": "20231015", 313 | "url": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/#/instance/50756302/58d88b01-8840-8771-a6dd-e51e9809df2c/data?dataType=mainform-20231015", 314 | "httpMethod": "POST", 315 | "accepts": [ 316 | "application/json" 317 | ], 318 | "requestSchema": "https://digdir.apps.tt02.altinn.no/digdir/super-simple-service/api/jsonschema/mainform-20231015", 319 | "responseSchema": "https://docs.altinn.studio/swagger/altinn-app-v1.json#/components/schemas/DataElement" 320 | } 321 | ] 322 | } 323 | ], 324 | "activities": [ 325 | { 326 | "createdAt": "2023-11-16T13:35:44.2268490Z", 327 | "type": "DialogCreated", 328 | "performedBy": { 329 | "actorType": "serviceOwner" 330 | } 331 | }, 332 | { 333 | "createdAt": "2023-11-16T13:35:44.2268490Z", 334 | "type": "Information", 335 | "performedBy": { 336 | "actorType": "serviceOwner" 337 | }, 338 | "description": [ 339 | { 340 | "value": "Skjema opprettet og forhåndsutfylt", 341 | "languageCode": "nb" 342 | }, 343 | { 344 | "value": "Form created and pre-filled", 345 | "languageCode": "en" 346 | } 347 | ] 348 | } 349 | ] 350 | } 351 | } 352 | 353 | script:pre-request { 354 | var uuid = require('uuid'); 355 | var dialogElementId = uuid.v4(); 356 | bru.setVar("dialogElementId", dialogElementId); 357 | console.log("dialogElementId", dialogElementId); 358 | 359 | var activityId = uuid.v4(); 360 | bru.setVar("activityId", activityId); 361 | console.log("activityId", activityId); 362 | } 363 | -------------------------------------------------------------------------------- /pre_request.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | 3 | // Define the Altinn class for Bruno environment 4 | const Altinn = class { 5 | // --- Constants for magic strings and configuration --- 6 | static TOKEN_GENERATOR_BASE_URL = "https://altinn-testtools-token-generator.azurewebsites.net/api"; 7 | static LOCAL_MASKINPORTEN_GENERATOR_URL = "http://localhost:17823?cache=true"; 8 | static TOKEN_CACHE_VAR_NAME = "tokenCache"; 9 | static DEFAULT_TOKEN_TTL_SECONDS = 86400; // 24 hours 10 | 11 | constructor(req) { 12 | this.req = req; 13 | } 14 | 15 | /** 16 | * Main authentication method to be called from the pre-request script. 17 | * @param {object} settings - Optional settings to override token parameters. 18 | */ 19 | async Authenticate(settings = {}) { 20 | await this._authenticateToken(settings); 21 | } 22 | 23 | /** 24 | * Handles the core logic of retrieving and setting the authentication token. 25 | * @param {object} settings - Settings for token generation. 26 | */ 27 | async _authenticateToken(settings) { 28 | // --- Early exit conditions --- 29 | 30 | // Check if Authorization header is already set at request level 31 | const existingAuth = this.req.getHeader("Authorization"); 32 | if (existingAuth) { 33 | console.log("Skipping token generation: Authorization header already set at request level."); 34 | // Extract token from "Bearer " format 35 | const token = existingAuth.replace(/^Bearer\s+/i, ''); 36 | this._logRequestDetails(token); 37 | return; 38 | } 39 | 40 | if (this._getVariable("DoNotSetAuthorizationHeader", null)) { 41 | console.log("Skipping token generation: 'DoNotSetAuthorizationHeader' is set."); 42 | return; 43 | } 44 | 45 | const manualToken = this._getVariable("MaskinportenAccessToken", null); 46 | if (manualToken) { 47 | console.log("Using manual 'MaskinportenAccessToken'."); 48 | this._setAuthorizationHeader(manualToken); 49 | return; 50 | } 51 | 52 | if (this._getVariable("UseMaskinportenTokenGenerator", null)) { 53 | console.log(`Using local MaskinportenTokenGenerator at ${Altinn.LOCAL_MASKINPORTEN_GENERATOR_URL}`); 54 | const token = await this._getTokenFromLocalGenerator(); 55 | this._setAuthorizationHeader(token); 56 | return; 57 | } 58 | 59 | // --- Proceed with standard token generation --- 60 | this._ensureRequiredCredentials(); 61 | 62 | const tokenParams = this._prepareTokenParameters(settings); 63 | const cacheKey = this._createCacheKey(tokenParams); 64 | 65 | const cachedToken = this._getCachedToken(cacheKey, tokenParams); 66 | if (cachedToken) { 67 | this._setAuthorizationHeader(cachedToken.token); 68 | return; 69 | } 70 | 71 | // Log token parameters when fetching new token (Postman-style) 72 | this._logTokenParameters(tokenParams); 73 | console.log(`Fetching new ${tokenParams.tokenType} token with scopes '${tokenParams.scopes}'`); 74 | const newToken = await this._fetchNewToken(tokenParams); 75 | this._setCachedToken(cacheKey, newToken); 76 | this._setAuthorizationHeader(newToken); 77 | } 78 | 79 | /** 80 | * Prepares the parameters for the token request by merging defaults and settings. 81 | */ 82 | _prepareTokenParameters(settings) { 83 | return { 84 | orgNo: settings.orgNo ?? null, 85 | tokenType: settings.tokenType ?? "enterprise", 86 | app: settings.app ?? "platform.undefined", 87 | scopes: settings.scopes ?? "altinn:serviceowner", 88 | org: settings.org ?? null, 89 | supplierOrgNo: settings.supplierOrgNo ?? null, 90 | partyId: settings.partyId ?? null, 91 | userId: settings.userId ?? null, 92 | userName: settings.userName ?? null, 93 | systemUserId: settings.systemUserId ?? null, 94 | systemUserOrg: settings.systemUserOrg ?? null, 95 | pid: settings.pid ?? null, 96 | env: this._getVariable("tokenEnvName", "at23"), 97 | ttl: Altinn.DEFAULT_TOKEN_TTL_SECONDS, 98 | }; 99 | } 100 | 101 | /** 102 | * Fetches a new token from the remote generator service. 103 | * @param {object} params - The parameters for the token request. 104 | * @returns {Promise} The new token. 105 | */ 106 | async _fetchNewToken(params) { 107 | const tokenUrl = this._buildTokenUrl(params); 108 | const basicAuthString = Buffer.from( 109 | `${this._getVariable("TokenGeneratorUserName")}:${this._getVariable("TokenGeneratorPassword")}` 110 | ).toString('base64'); 111 | 112 | try { 113 | const response = await axios.get(tokenUrl, { 114 | headers: { 'Authorization': `Basic ${basicAuthString}` } 115 | }); 116 | 117 | if (response.status !== 200) { 118 | throw new Error(`Token generator responded with status ${response.status}: ${response.data}`); 119 | } 120 | return response.data; 121 | } catch (error) { 122 | console.error("Failed to fetch new token:", error.message); 123 | throw error; 124 | } 125 | } 126 | 127 | /** 128 | * Constructs the appropriate token generator URL based on the token type. 129 | * @param {object} params - The parameters for the token request. 130 | * @returns {string} The fully constructed URL. 131 | */ 132 | _buildTokenUrl(params) { 133 | const tokenTypeConfig = { 134 | enterprise: { path: "/GetEnterpriseToken", params: ["orgNo", "org", "partyId", "supplierOrgNo"] }, 135 | platform: { path: "/GetPlatformToken", params: ["app"] }, 136 | person: { path: "/GetPersonalToken", params: ["pid", "partyId", "userId"] }, 137 | enterpriseuser: { path: "/GetEnterpriseUserToken", params: ["orgNo", "partyId", "userId", "userName"] }, 138 | systemuser: { path: "/GetSystemUserToken", params: ["systemUserId", "systemUserOrg"] }, 139 | }; 140 | 141 | const config = tokenTypeConfig[params.tokenType]; 142 | if (!config) { 143 | throw new Error(`Unknown token type: ${params.tokenType}`); 144 | } 145 | 146 | const baseUrl = `${Altinn.TOKEN_GENERATOR_BASE_URL}${config.path}`; 147 | const queryParams = { 148 | env: params.env, 149 | ttl: params.ttl, 150 | scopes: params.scopes, 151 | }; 152 | 153 | // Add token-specific parameters to the query object 154 | config.params.forEach(p => { 155 | if (params[p]) { 156 | queryParams[p] = params[p]; 157 | } 158 | }); 159 | 160 | // Build the query string with URL encoding for compatibility 161 | const queryString = Object.entries(queryParams) 162 | .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`) 163 | .join('&'); 164 | 165 | return `${baseUrl}?${queryString}`; 166 | } 167 | 168 | /** 169 | * Fetches a token from the local Maskinporten token generator. 170 | * @returns {Promise} The access token. 171 | */ 172 | async _getTokenFromLocalGenerator() { 173 | try { 174 | const response = await axios.get(Altinn.LOCAL_MASKINPORTEN_GENERATOR_URL); 175 | if (response.status !== 200) { 176 | throw new Error(`Local generator responded with status ${response.status}`); 177 | } 178 | if (!response.data?.access_token) { 179 | throw new Error("No access_token in response from local generator."); 180 | } 181 | console.log("Successfully got token from local MaskinportenTokenGenerator."); 182 | return response.data.access_token; 183 | } catch (error) { 184 | console.error("Failed to connect to local Maskinporten token generator:", error.message); 185 | throw new Error("Unable to get token from local generator. Ensure https://github.com/altinn/MaskinportenTokenGenerator is running in server mode."); 186 | } 187 | } 188 | 189 | // --- Caching Helper Methods --- 190 | 191 | _getCache() { 192 | try { 193 | const cacheString = bru.getEnvVar(Altinn.TOKEN_CACHE_VAR_NAME); 194 | if (!cacheString) return {}; 195 | return JSON.parse(cacheString); 196 | } catch (error) { 197 | console.warn("Could not parse token cache. Starting with a fresh cache.", error); 198 | return {}; 199 | } 200 | } 201 | 202 | _setCache(cache) { 203 | const cacheString = JSON.stringify(cache); 204 | bru.setEnvVar(Altinn.TOKEN_CACHE_VAR_NAME, cacheString); 205 | } 206 | 207 | _getCachedToken(key, tokenParams) { 208 | const cache = this._getCache(); 209 | const cachedItem = cache[key]; 210 | 211 | if (cachedItem && cachedItem.validUntil > Date.now()) { 212 | // Log token parameters and cache validity (Postman-style) 213 | this._logTokenParameters(tokenParams); 214 | console.log(`Cached token valid until ${new Date(cachedItem.validUntil).toString()}`); 215 | return cachedItem; 216 | } 217 | return null; 218 | } 219 | 220 | _setCachedToken(key, token) { 221 | const cache = this._getCache(); 222 | const validUntil = Date.now() + (Altinn.DEFAULT_TOKEN_TTL_SECONDS - 60) * 1000; // 1 min buffer 223 | cache[key] = { token, validUntil }; 224 | this._setCache(cache); 225 | console.log(`Token cached until ${new Date(validUntil).toLocaleString()}`); 226 | } 227 | 228 | _createCacheKey(params) { 229 | // Creates a consistent key from the most relevant token parameters. 230 | const keyParts = [ 231 | params.env, params.orgNo, params.org, params.partyId, 232 | params.tokenType, params.scopes, params.app, params.userId, 233 | params.pid, params.systemUserId 234 | ]; 235 | return keyParts.filter(p => p).join('_'); // Filter out null/undefined parts 236 | } 237 | 238 | // --- Utility Methods --- 239 | 240 | _setAuthorizationHeader(token) { 241 | const headerName = this._getVariable("AuthorizationHeaderName", "Authorization"); 242 | // Clear the header first to prevent potential duplicates 243 | this.req.setHeader(headerName, null); 244 | this.req.setHeader(headerName, `Bearer ${token}`); 245 | 246 | // Log request details (Postman-style) 247 | this._logRequestDetails(token); 248 | } 249 | 250 | _getVariable(name, defaultValue = undefined) { 251 | // Defines a clear lookup order: collection, environment, process 252 | // The 'bru' object is globally available in the Bruno script environment. 253 | const lookupOrder = [ 254 | (varName) => bru.getCollectionVar(varName), 255 | (varName) => bru.getEnvVar(varName), 256 | (varName) => bru.getProcessEnv(varName) 257 | ]; 258 | 259 | for (const getter of lookupOrder) { 260 | const value = getter(name); 261 | if (value !== undefined && value !== null) { 262 | return value; 263 | } 264 | } 265 | 266 | if (defaultValue === undefined) { 267 | console.warn(`Unset variable and no default provided: ${name}`); 268 | } 269 | return defaultValue; 270 | } 271 | 272 | _ensureRequiredCredentials() { 273 | const requiredVars = ['TokenGeneratorUserName', 'TokenGeneratorPassword']; 274 | for (const varName of requiredVars) { 275 | if (!this._getVariable(varName, null)) { 276 | throw new Error(`Missing required variable '${varName}'. Please ensure it's set in your collection's .env file.`); 277 | } 278 | } 279 | } 280 | 281 | /** 282 | * Logs token parameters in Postman style 283 | */ 284 | _logTokenParameters(params) { 285 | // Only log non-null parameters that are relevant 286 | const relevantParams = {}; 287 | const keysToLog = ['orgNo', 'tokenType', 'org', 'scopes', 'app', 'partyId', 'userId', 'pid', 'systemUserId', 'systemUserOrg']; 288 | 289 | keysToLog.forEach(key => { 290 | if (params[key] !== null && params[key] !== undefined && params[key] !== 'platform.undefined') { 291 | relevantParams[key] = params[key]; 292 | } 293 | }); 294 | 295 | if (Object.keys(relevantParams).length > 0) { 296 | console.log(relevantParams); 297 | } 298 | } 299 | 300 | /** 301 | * Logs request details in Postman style 302 | */ 303 | _logRequestDetails(token) { 304 | const method = this.req.getMethod(); 305 | const url = this.req.getUrl(); 306 | 307 | console.log(`${method} ${url}:`); 308 | 309 | const requestLog = { 310 | "Request Headers": { 311 | "authorization": `Bearer ${token}` 312 | } 313 | }; 314 | 315 | // Add other headers if available 316 | const headers = this.req.getHeaders(); 317 | if (headers) { 318 | Object.keys(headers).forEach(key => { 319 | if (key.toLowerCase() !== 'authorization') { 320 | requestLog["Request Headers"][key] = headers[key]; 321 | } 322 | }); 323 | } 324 | 325 | console.log(requestLog); 326 | } 327 | }; 328 | 329 | module.exports = Altinn; 330 | --------------------------------------------------------------------------------