Skip to content

Log to accounts

/account_change_log/log_to_accounts

Target audience: Developers

Release version: 4.4.0

Log to accounts

Introduction

This endpoint is used for batch logging to multiple accounts at once. To list available categories you can use the available categories endpoint.

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v1/account_change_log/available_categories
Production https://backend.worldoftulo.com/external/api/v1/account_change_log/available_categories

Requirements

Identity Scope
No /external/account_change_log/w

Parameters

Name Type Description Required
change_logs Array Array of account change logs
Size range: 1..1000 Allowed values: Change log objects
Yes

Change log

Change log properties Type Description Required
account_id String Account id
Size range: 1..1000 Allowed values: "/^[a-f\d]{24}$/i"
Yes
category_type String Category type
Allowed values: available categories
Yes
message String Message
Size range: 1..1024
Yes
requested_by String Who requested the change
Size range: 1..100
Yes

Curl Example

curl --request PUT \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/account_change_log/log_to_accounts \
  --header 'accept: application/json' \
  --header 'authorization: Bearer <token>' \
  --header 'content-type: application/json' \
  --data '{
            "change_logs": [
                {
                  "account_id": "6107cc1509c04cb9949c25fd",
                  "category_type": "distribution",
                  "message": "message",
                  "requested_by": "requested_by@email.com"                
                },
                {
                  "account_id": "6107cc1509c04cb9949c25ff",
                  "category_type": "distribution",
                  "message": "message",
                  "requested_by": "requested_by@email.com"                
                },
                {
                  "account_id": "6107cc1509c04cb9949c2601",
                  "category_type": "distribution",
                  "message": "message",
                  "requested_by": "requested_by@email.com"                
                }
                .......
                ......
                ......and so forth
            ]
          }' \

Response

A successful response will always return status code 207 to indicate that it's a multipart response. The response contains two arrays ok: [] and errors: []. If the result is a partial success the errors will be listed in the errors arrays. See response example partially successful response for an example.

This way you can resolve any errors in isolation without having the need to re-submit all of the change logs.

An unsuccessful response such as a 404 or a 500 response is returned as a normal error. See errors.

Successful response

HTTP 207
{
  "ok": [
    "6107cc1509c04cb9949c25fd",
    "6107cc1509c04cb9949c25ff",
    "6107cc1509c04cb9949c2601",
    "6107cc1509c04cb9949c2603",
    "6107cc1509c04cb9949c2605",
    "6107cc1509c04cb9949c2607",
    "6107cc1509c04cb9949c2609",
    "6107cc1509c04cb9949c260b",
    "6107cc1509c04cb9949c260d",
    "6107cc1509c04cb9949c260f",
    "6107cc1509c04cb9949c2611",
    "6107cc1509c04cb9949c2613",
    "6107cc1509c04cb9949c2615",
    "6107cc1509c04cb9949c2617",
    "6107cc1509c04cb9949c2619",
    "6107cc1509c04cb9949c261b",
    "6107cc1509c04cb9949c261d",
    "6107cc1509c04cb9949c261f",
    "6107cc1509c04cb9949c2621",
    "6107cc1509c04cb9949c2623",
    "6107cc1509c04cb9949c2625",
    "6107cc1509c04cb9949c2627",
    "6107cc1509c04cb9949c2629",
    "6107cc1509c04cb9949c262b",
    "6107cc1509c04cb9949c262d"
  ],
  "errors": []
}

Partially successful response

HTTP 207
{
  "ok": [
    "6107cb9309c04cb8b68507bc",
    "6107cb9309c04cb8b68507be",
    "6107cb9309c04cb8b68507c0",
    "6107cb9309c04cb8b68507c2",
    "6107cb9309c04cb8b68507c4"
  ],
  "errors": [
    {
      "payload": {
        "account_id": "6107cb9309c04cb8b68507c6",
        "created_at": "2021-08-02T12:40:19.793+02:00",
        "message": "distribution has changed",
        "cateogory": "distribution",
        "requested_by": "requested_by@email.com"
      },
      "error_message": "cannot log to archived account"
    },
    {
      "payload": {
        "account_id": "6107cb9309c04cb8b68507c8",
        "created_at": "2021-08-02T12:40:19.793+02:00",
        "message": "distribution has changed",
        "cateogory": "distribution",
        "requested_by": "requested_by@email.com"
      },
      "error_message": "cannot log to archived account"
    },
    {
      "payload": {
        "account_id": "6107cb9309c04cb8b68507ca",
        "created_at": "2021-08-02T12:40:19.793+02:00",
        "message": "distribution has changed",
        "cateogory": "distribution",
        "requested_by": "requested_by@email.com"
      },
      "error_message": "cannot log to archived account"
    },
    {
      "payload": {
        "account_id": "6107cb9309c04cb8b68507cc",
        "created_at": "2021-08-02T12:40:19.793+02:00",
        "message": "distribution has changed",
        "cateogory": "distribution",
        "requested_by": "requested_by@email.com"
      },
      "error_message": "cannot log to archived account"
    },
    {
      "payload": {
        "account_id": "6107cb9309c04cb8b68507ce",
        "created_at": "2021-08-02T12:40:19.793+02:00",
        "message": "distribution has changed",
        "cateogory": "distribution",
        "requested_by": "requested_by@email.com"
      },
      "error_message": "cannot log to archived account"
    },
    {
      "payload": {
        "account_id": "6107cb9309c04cb8b68507d0",
        "created_at": "2021-08-02T12:40:19.793+02:00",
        "message": "distribution has changed",
        "cateogory": "distribution",
        "requested_by": "requested_by@email.com"
      },
      "error_message": "account 6107cb9309c04cb8b68507d0 does not belong to organisation"
    },
    {
      "payload": {
        "account_id": "6107cb9309c04cb8b68507d2",
        "created_at": "2021-08-02T12:40:19.794+02:00",
        "message": "distribution has changed",
        "cateogory": "distribution",
        "requested_by": "requested_by@email.com"
      },
      "error_message": "account 6107cb9309c04cb8b68507d2 does not belong to organisation"
    },
    {
      "payload": {
        "account_id": "6107cb9309c04cb8b68507d4",
        "created_at": "2021-08-02T12:40:19.794+02:00",
        "message": "distribution has changed",
        "cateogory": "distribution",
        "requested_by": "requested_by@email.com"
      },
      "error_message": "account 6107cb9309c04cb8b68507d4 does not belong to organisation"
    },
    {
      "payload": {
        "account_id": "6107cb9309c04cb8b68507d6",
        "created_at": "2021-08-02T12:40:19.794+02:00",
        "message": "distribution has changed",
        "cateogory": "distribution",
        "requested_by": "requested_by@email.com"
      },
      "error_message": "account 6107cb9309c04cb8b68507d6 does not belong to organisation"
    },
    {
      "payload": {
        "account_id": "6107cb9309c04cb8b68507d8",
        "created_at": "2021-08-02T12:40:19.794+02:00",
        "message": "distribution has changed",
        "cateogory": "distribution",
        "requested_by": "requested_by@email.com"
      },
      "error_message": "account 6107cb9309c04cb8b68507d8 does not belong to organisation"
    }
  ]
}

Errors

This API uses the common error conventions of the Payway API

See common error responses