Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Beskrivning

Generell tjänst för att hantera medborgares och organisationers inställningar för hur återkoppling ska ske (för till exempel felanmälningar och driftstörningar). 

Livscykelstatus

Under utvecklingbaseUrlhttps://sundsvall.atlassian.net/wiki

Produktion

Lösningsbeskrivning

Gliffy

imageAttachmentIdatt29949965macroIde0cdd404-6147-48c0-b661-3cb73c11a997

displayNamefeedbackSettingsAPI Copy
namefeedbackSettingsAPI Copy

diagramAttachmentIdcontainerId29065265timestamp1643707761929

pagePin

att29393082

2



Hantering av personuppgifter

PersonId används för att knyta återkopplingsuppgifterna till en specifik individ. PersonId är obligatoriskt. I fall personen företräder en organisation så används personId i kombination med organisationsId för att knyta de återkopplingsuppgifter som gäller när personen företräder organisationen. Dvs, en person kan ha en specifik uppsättning återkopplingsuppgifter för personligt bruk samtidigt som hen har en annan uppsättning för respektive organisation som hen företräder. En organisation kan ha en eller flera företrädande personer.

API specifikation

Swagger ui
---
openapi: 3.0.2
info:
  title: api-feedbacksettings-dev API
  version: "1.0"
paths:
  /settings:
    get:
      tags:
      - Feedback Settings Resource
      parameters:
      - name: limit
        in: query
        schema:
          format: int32
          default: 20
          minimum: 1
          type: integer
      - name: organizationId
        in: query
        schema:
          type: string
      - name: page
        in: query
        schema:
          format: int32
          default: 1
          minimum: 1
          type: integer
      - name: personId
        in: query
        schema:
          type: string
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResult'
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
        "404":
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
        "500":
          description: Internal Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
    post:
      tags:
      - Feedback Settings Resource
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFeedbackSettingsRequest'
      responses:
        "201":
          description: Created
          content: {}
        "400":
          description: Bad request
          content: {}
        "500":
          description: Internal Server error
          content: {}
  /settings/{id}:
    get:
      tags:
      - Feedback Settings Resource
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeedbackSettings'
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
        "404":
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
        "500":
          description: Internal Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
    delete:
      tags:
      - Feedback Settings Resource
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "204":
          description: Successful operation
        "400":
          description: Bad request
          content: {}
        "404":
          description: Not found
          content: {}
        "500":
          description: Internal Server error
          content: {}
    patch:
      tags:
      - Feedback Settings Resource
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFeedbackSettingsRequest'
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeedbackSettings'
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
        "404":
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
        "500":
          description: Internal Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceErrorResponse'
components:
  schemas:
    ContactMethod:
      enum:
      - EMAIL
      - SMS
      type: string
    CreateFeedbackSettingsRequest:
      description: Request model for creating new feedback settings
      required:
      - personId
      type: object
      properties:
        personId:
          description: Unique id for the person to whom the feedback setting shall
            apply
          type: string
          example: 15aee472-46ab-4f03-9605-68bd64ebc73f
          nullable: false
        organizationId:
          description: Unique id for the company to which the feedback setting shall
            apply if the setting refers to an organizational representative
          type: string
          example: 15aee472-46ab-4f03-9605-68bd64ebc84a
        channels:
          type: array
          items:
            $ref: '#/components/schemas/RequestedFeedbackChannel'
    FeedbackChannel:
      description: Feedback channel model
      type: object
      properties:
        contactMethod:
          allOf:
          - $ref: '#/components/schemas/ContactMethod'
          - description: Method of contact
            readOnly: true
            example: SMS
        destination:
          description: Point of destination
          type: string
          readOnly: true
        sendFeedback:
          description: 'Signal if channel should be used or not when sending feedback '
          type: boolean
          readOnly: true
          example: true
    FeedbackSettings:
      description: Feedback settings response model
      type: object
      properties:
        id:
          description: Unique id for the feedback setting
          type: string
          readOnly: true
          example: 0d64c132-3aea-11ec-8d3d-0242ac130003
        personId:
          description: Unique id for the person to whom the feedback setting applies
          type: string
          readOnly: true
          example: 15aee472-46ab-4f03-9605-68bd64ebc73f
        organizationId:
          description: Unique id for the company to which the feedback setting applies
            in cases where the setting refers to an organizational representative
          type: string
          readOnly: true
          example: 15aee472-46ab-4f03-9605-68bd64ebc84a
        channels:
          type: array
          items:
            description: Feedback channel model
            type: object
            properties:
              contactMethod:
                allOf:
                - $ref: '#/components/schemas/ContactMethod'
                - description: Method of contact
                  readOnly: true
                  example: SMS
              destination:
                description: Point of destination
                type: string
                readOnly: true
              sendFeedback:
                description: 'Signal if channel should be used or not when sending
                  feedback '
                type: boolean
                readOnly: true
                example: true
          readOnly: true
        created:
          format: date-time
          description: Timestamp for creation
          type: string
          readOnly: true
          example: 2022-01-20T10:30:09.469+01:00
        modified:
          format: date-time
          description: Timestamp for last modification
          type: string
          readOnly: true
          example: 2022-01-20T10:30:09.469+01:00
    MetaData:
      description: Metadata model
      type: object
      properties:
        page:
          format: int32
          description: Current page
          type: integer
          readOnly: true
          example: 5
        limit:
          format: int32
          description: Displayed objects per page
          type: integer
          readOnly: true
          example: 20
        count:
          format: int32
          description: Displayed objects on current page
          type: integer
          readOnly: true
          example: 13
        totalRecords:
          format: int64
          description: Total amount of hits based on provided search parameters
          type: integer
          readOnly: true
          example: 98
        totalPages:
          format: int32
          description: Total amount of pages based on provided search parameters
          type: integer
          readOnly: true
          example: 23
    RequestedFeedbackChannel:
      description: Requested feedback channel model
      required:
      - contactMethod
      - destination
      - sendFeedback
      type: object
      properties:
        contactMethod:
          allOf:
          - $ref: '#/components/schemas/ContactMethod'
          - description: Method of contact
            example: SMS
            nullable: false
        destination:
          description: Point of destination
          type: string
          example: "0701234567"
        sendFeedback:
          description: 'Signal if channel should be used or not when sending feedback '
          type: boolean
          example: true
          nullable: false
    SearchResult:
      description: Search result response model
      type: object
      properties:
        _meta:
          $ref: '#/components/schemas/MetaData'
        feedbackSettings:
          type: array
          items:
            description: Feedback settings response model
            type: object
            properties:
              id:
                description: Unique id for the feedback setting
                type: string
                readOnly: true
                example: 0d64c132-3aea-11ec-8d3d-0242ac130003
              personId:
                description: Unique id for the person to whom the feedback setting
                  applies
                type: string
                readOnly: true
                example: 15aee472-46ab-4f03-9605-68bd64ebc73f
              organizationId:
                description: Unique id for the company to which the feedback setting
                  applies in cases where the setting refers to an organizational representative
                type: string
                readOnly: true
                example: 15aee472-46ab-4f03-9605-68bd64ebc84a
              channels:
                type: array
                items:
                  description: Feedback channel model
                  type: object
                  properties:
                    contactMethod:
                      allOf:
                      - $ref: '#/components/schemas/ContactMethod'
                      - description: Method of contact
                        readOnly: true
                        example: SMS
                    destination:
                      description: Point of destination
                      type: string
                      readOnly: true
                    sendFeedback:
                      description: 'Signal if channel should be used or not when sending
                        feedback '
                      type: boolean
                      readOnly: true
                      example: true
                readOnly: true
              created:
                format: date-time
                description: Timestamp for creation
                type: string
                readOnly: true
                example: 2022-01-20T10:30:09.469+01:00
              modified:
                format: date-time
                description: Timestamp for last modification
                type: string
                readOnly: true
                example: 2022-01-20T10:30:09.469+01:00
          readOnly: true
    ServiceErrorResponse:
      type: object
      properties:
        httpCode:
          format: int32
          type: integer
        message:
          type: string
        technicalDetails:
          $ref: '#/components/schemas/TechnicalDetails'
    TechnicalDetails:
      type: object
      properties:
        rootCode:
          format: int32
          type: integer
        rootCause:
          type: string
        serviceId:
          type: string
        details:
          type: array
          items:
            type: string
    UpdateFeedbackSettingsRequest:
      description: Request model for updating feedback settings
      type: object
      properties:
        channels:
          type: array
          items:
            $ref: '#/components/schemas/RequestedFeedbackChannel'

Här beskrivs några exempel på anrop som är möjliga att göra mot FeedbackSettings API.

En fullständig OpenAPI-specifikation finns i WSO2 Devportal.

Lagra återkopplingsinställningar

POST /settings

Request body:

Code Block
languagejson
{
	"personId": "49a974ea-9137-419b-bcb9-ad74c81a1d1a",
	"channels": [
		{
			"contactMethod": "SMS",
			"destination": "0701234567",
			"sendFeedback": false
		},
		{
			"contactMethod":"EMAIL",
			"destination":"test.testorsson@test.se",
			"sendFeedback":true
		}
	]
}

Response body:

Code Block
languagejson
{
	"id": "15aee472-46ab-4f03-9605-68bd64ebc73a",
	"personId": "49a974ea-9137-419b-bcb9-ad74c81a1d1a",
	"channels":[
		{
			"contactMethod":"SMS",
			"destination": "0701234567",
			"sendFeedback": false
		},
		{
			"contactMethod":"EMAIL",
			"destination":"test.testorsson@successful.create",
			"sendFeedback":true
		}
	],
	"created": "${json-unit.any-string}"
}

Hämta alla återkopplingsinställningar

GET /settings

Response body:

Code Block
languagejson
[
    {
        "id": 1,
        "mobileNumber": "0731231212",
        "emailAddress": "test.testorsson@test.se",
        "personId": "15aee472-46ab-4f03-9605-68bd64ebc73a",
        "primaryContactMethod": "SMS",
        "sendFeedback": true
    },
    {
        "id": 2,
        "mobileNumber": "0722222222",
        "emailAddress": "2.testorsson@test.se",
        "personId": "15aee472-46ab-4f03-9605-68bd64ebc732",
        "primaryContactMethod": "EMAIL",
        "sendFeedback": false
    },
    {
        "id": 3,
        "mobileNumber": "0703333333",
        "emailAddress": "3.testorsson@test.se",
        "personId": "15aee472-46ab-4f03-9605-61ba64ebc733",
        "primaryContactMethod": "SMS",
        "sendFeedback": false
    }
]

Hämta återkopplingsinställningar med query parameters

GET /settings?emailAddress=test.testorsson@test.se&mobileNumber=0731231212&personId=15aee472-46ab-4f03-9605-68bd64ebc73f

Query parameters:

  • emailAddress

  • mobileNumber

  • personId

Response body:

Code Block
languagejson
[
    {
        "id": 1,
        "mobileNumber": "0731231212",
        "emailAddress": "test.testorsson@test.se",
        "personId": "15aee472-46ab-4f03-9605-68bd64ebc73f",
        "primaryContactMethod": "SMS",
        "sendFeedback": true
    }
]

Hämta återkopplingsinställning med id

GET /settings/2

Code Block
languagejson
{
    "id": 2,
    "mobileNumber": "0722222222",
    "emailAddress": "2.testorsson@test.se",
    "personId": "15aee472-46ab-4f03-9605-68bd64ebc732",
    "primaryContactMethod": "EMAIL",
    "sendFeedback": false
}

Uppdatera återkopplingsinställning

Uppdaterar en viss del av resursen.

PATCH /settings/2

Request body:

Code Block
languagejson
{
    "mobileNumber": "0703213232",
    "emailAddress": "changed_email@test.se"
}

Response body:

Code Block
languagejson
{
    "id": 2,
    "mobileNumber": "0703213232",
    "emailAddress": "changed_email@test.se",
    "personId": "15aee472-46ab-4f03-9605-68bd64ebc732",
    "primaryContactMethod": "EMAIL",
    "sendFeedback": false
}

Ta bort återkopplingsinställning

DELETE /settings/2

Response body:

Code Block
languagejson
{ "id": 2, "mobileNumber": "0703213232", "emailAddress": "changed_email@test.se", "personId": "15aee472-46ab-4f03-9605-68bd64ebc732", "primaryContactMethod": "EMAIL", "sendFeedback": false }

En person eller företrädare för en organisation kan ha 0-n poster i listan över kontaktmetoder, men kan ej ha flera poster med samma innehåll. Dvs, hen kan tex bara ha en post med kontaktkanal SMS och destination 0701234567. Hen kan däremot ha flera poster för tex SMS, så länge destinationen skiljer sig åt mellan dem. Exempelvis:


Code Block
languagejson

API specifikation

Open api
urlhttps://api.sundsvall.se/feedbacksettings/api-docs

Säkerhetsklassning

Säkerhetsklass 1

Autentiseringsmetod: Oauth2

(Ref: Säkerhetsklassning av APIer )

API-ägare

<Kontaktuppgifter till den verksamhet som äger APIets livscykel>

Teknisk ägare

https://sundsvall.atlassian.net/wiki/spaces/API

<FAQ>

För tekniska frågor: teamunmasked@sundsvall.se

Länkar

Länkar till dev-portal;

FAQ

Källkod

Github

FAQ