Update Action

Update Actions Endpoint

PATCH {baseUrl}/openapi/api/v1/actions


Purpose

The Update Actions API enables partners to bulk-update actions by submitting a structured payload.

The API:

  • Validates the input

  • Maps it to the legacy API format

  • Processes the request

  • Returns a detailed response


Request Requirements

  1. Authorization:

    • Include a valid JWT token in the Authorization header.

    • Tokens are validated via Keycloak before processing.

  2. Validation:

    • The service validates all payloads in the request before forwarding them to the legacy API.

    • If any payload fails validation, the entire request is rejected, and no calls to the legacy API are made.

    • In the first example, the input payload can be seen as what is required(validated) and what is validated only if provided.

  3. Bulk Operation:

    • It supports bulk updating actions in a single request.

  4. Response

  • 200 - Success All actions are successfully updated.

  • 207 - Partial Success At least one action failed and at least one action has succed.

  • 400 - Failure Validation of the payload failed, and no actions were processed.

  • 404 - Not found Given actionId(s) are not found. There’s a call to the core API for each ID.

Examples

Example input of success 200:

{
  "data": [
    {
      "actionId": "19353",
      "partner_ids": [
        "6042dbca-93a4-418e-b625-b7da58eaf6d4",
        "21d6955f-244e-439a-a432-a45d45ab8b34"
      ],
      "title": {
        "en": "Leave Approval",
        "fr": "Title.Updated"
      },
      "subtitle": {
        "en": "Leave request for approval",
        "fr": "Subtitle.Updated"
      },
      "details": {
        "en": "Please approve the leave request via the external tool.",
        "fr": "Details.Updated"
      },
      "status": "active",
      "effective_date": "2024-03-10 00:00:00",
      "due_date": "2024-01-10 06:51:15",
      "expires_at": "2024-03-10 00:09:30",
      "client_info": {
        "external_id": "6042dbca-93a4-418e-b625-b7da58eaf6d4",
        "provider_name": "CSOD",
        "company_name": "Sfam",
        "module_name": "EPM_PERF_REVIEW"
      },
      "redirect_url": "https://lucca.fr/action/validate?id=1234",
      "type_action": "link"
    },
    {
      "actionId": "19354",
      "title": {
        "en": "Leave Approval",
        "fr": "Approbation de congé"
      },
      "status": "done",
      "effective_date": "2024-03-22 00:00:00",
      "due_date": "2024-01-22 06:51:15",
      "expires_at": "2024-03-22 00:09:30",
      "action_group": "Sales Department",
      "category_action": "link"
    }
  ]
}
Required, validated
Validated only if provided

actionId

category_action

Valid values:

  • validation

  • link

  • form

  • todo

  • schedule

status

If provided valid values are:

  • active

  • inactive

  • draft

  • approved

  • pending

  • done

type_action

Valid values:

  • validation

  • link

  • form

  • todo

  • schedule

author_id - cannot be updated

Response:

{
    "status": "All actions successfully updated",
    "statistics": {
        "total": 2,
        "successCount": 2,
        "failureCount": 0
    },
    "actions": [
        {
            "actionId": 19353,
            "status": "success",
            "actionData": {
                "id": 19353,
                "comments": [],
                "author": {
                    "username": "[email protected]",
                    "first_name": "Delphine",
                    "last_name": "LEBRUN",
                    "professional_email": "[email protected]",
                    "is_active": "true",
                    "professional_mobile_phone": null,
                    "professional_phone": null,
                    "user_photo": "https://rest-dev.monportailrh.com/storage/rdpartyzone/images/users/default/omiYfTS2CtnO9wvFvjC1ySLIfShw1HlIkMDuaGEl6446308ddaecb.png",
                    "linkedin_profile": null,
                    "employee_position": null,
                    "id": 80,
                    "external_id": "55f9c663-91c2-43ca-8e0a-e8de4f155c7b",
                    "role": [
                        "mes_liens_formulaires",
                        "user",
                        "salarie"
                    ],
                    "status": "default",
                    "settings": {
                        "display_language": "fr",
                        "locale": "fr_FR",
                        "timezone": "+00:00",
                        "usr_date_format": "DD/MM/YYYY",
                        "usr_time_format": "HH:mm"
                    }
                },
                "title": "Title.Updated",
                "subtitle": "Subtitle.Updated",
                "details": "Details.Updated",
                "type": {
                    "id": 3,
                    "name": "Lien",
                    "alias": "link",
                    "category": "link"
                },
                "link": "https://lucca.fr/action/validate?id=1234",
                "status": "active",
                "icon": null,
                "payload": {
                    "external_id": "6042dbca-93a4-418e-b625-b7da58eaf6d4",
                    "provider_name": "CSOD",
                    "company_name": "Sfam",
                    "module_name": "EPM_PERF_REVIEW"
                },
                "effective_date": "2024-03-10 00:00:00",
                "delegated_from": null,
                "expires_at": "2024-03-10 00:00:00",
                "expired": true,
                "created_at": "2025-01-02 15:11:00",
                "updated_at": "2025-01-31 07:46:01"
            }
        },
        {
            "actionId": 19354,
            "status": "success",
            "actionData": {
                "id": 19354,
                "comments": [],
                "author": {
                    "username": "[email protected]",
                    "first_name": "Delphine",
                    "last_name": "LEBRUN",
                    "professional_email": "[email protected]",
                    "is_active": "true",
                    "professional_mobile_phone": null,
                    "professional_phone": null,
                    "user_photo": "https://rest-dev.monportailrh.com/storage/rdpartyzone/images/users/default/omiYfTS2CtnO9wvFvjC1ySLIfShw1HlIkMDuaGEl6446308ddaecb.png",
                    "linkedin_profile": null,
                    "employee_position": null,
                    "id": 80,
                    "external_id": "55f9c663-91c2-43ca-8e0a-e8de4f155c7b",
                    "role": [
                        "mes_liens_formulaires",
                        "user",
                        "salarie"
                    ],
                    "status": "default",
                    "settings": {
                        "display_language": "fr",
                        "locale": "fr_FR",
                        "timezone": "+00:00",
                        "usr_date_format": "DD/MM/YYYY",
                        "usr_time_format": "HH:mm"
                    }
                },
                "title": "Title.Updated",
                "subtitle": "Subtitle.Updated",
                "details": "Details.Updated",
                "type": {
                    "id": 3,
                    "name": "Lien",
                    "alias": "link",
                    "category": "link"
                },
                "link": "https://lucca.fr/action/validate?id=1234",
                "status": "done",
                "icon": null,
                "payload": {
                    "external_id": "6042dbca-93a4-418e-b625-b7da58eaf6d4",
                    "module_name": "EPM_PERF_REVIEW",
                    "company_name": "Sfam",
                    "provider_name": "CSOD"
                },
                "effective_date": "2024-03-22 00:00:00",
                "delegated_from": null,
                "expires_at": "2024-03-22 00:00:00",
                "expired": true,
                "created_at": "2025-01-02 15:11:00",
                "updated_at": "2025-01-28 15:56:35"
            }
        }
    ]
}

We have two successfully updated actions therefore two returned actions.


Example input of partial success 207 with 2 requests for actions:

{
    "data": [
        {
            "actionId": "19470",
            "partner_ids": [
                "6042dbca-93a4-418e-b625-b7da58eaf6d4",
                "21d6955f-244e-439a-a432-a45d45ab8b34"
            ],
            "title": {
                "en": "Leave Approval",
                "fr": "Title.Updated"
            },
            "subtitle": {
                "en": "Leave request for approval",
                "fr": "Subtitle.Updated"
            },
            "details": {
                "en": "Please approve the leave request via the external tool.",
                "fr": "Details.Updated"
            },
            "status": "active",
            "effective_date": "2024-03-10 00:00:00",
            "due_date": "2024-01-10 06:51:15",
            "expires_at": "2024-03-10 00:09:30",
            "client_info": {
                "external_id": "6042dbca-93a4-418e-b625-b7da58eaf6d4",
                "provider_name": "CSOD",
                "company_name": "Sfam",
                "module_name": "EPM_PERF_REVIEW"
            },
            "redirect_url": "https://lucca.fr/action/validate?id=1234"
        },
        {
            "actionId": "19354",
            "title": {
                "en": "Something_has_been_changed",
                "fr": "Same in french"
            },
            "status": "done",
            "effective_date": "2024-03-22 00:00:00",
            "due_date": "2024-01-22 06:51:15",
            "expires_at": "2024-03-22 00:09:30",
            "action_group": "Sales Department"
        }
    ]
}

Response:

{
    "status": "Partial success: 1 action(s) updated, 1 action(s) failed",
    "statistics": {
        "total": 2,
        "successCount": 1,
        "failureCount": 1
    },
    "actions": [
        {
            "actionId": 19470,
            "status": "error",
            "message": "No query results for model [App\\Models\\Action] 19470",
            "errors": null
        },
        {
            "actionId": 19354,
            "status": "success",
            "actionData": {
                "id": 19354,
                "comments": [],
                "author": {
                    "username": "[email protected]",
                    "first_name": "Delphine",
                    "last_name": "LEBRUN",
                    "professional_email": "[email protected]",
                    "is_active": "true",
                    "professional_mobile_phone": null,
                    "professional_phone": null,
                    "user_photo": "https://rest-dev.monportailrh.com/storage/rdpartyzone/images/users/default/omiYfTS2CtnO9wvFvjC1ySLIfShw1HlIkMDuaGEl6446308ddaecb.png",
                    "linkedin_profile": null,
                    "employee_position": null,
                    "id": 80,
                    "external_id": "55f9c663-91c2-43ca-8e0a-e8de4f155c7b",
                    "role": [
                        "mes_liens_formulaires",
                        "user",
                        "salarie"
                    ],
                    "status": "default",
                    "settings": {
                        "display_language": "fr",
                        "locale": "fr_FR",
                        "timezone": "+00:00",
                        "usr_date_format": "DD/MM/YYYY",
                        "usr_time_format": "HH:mm"
                    }
                },
                "title": "Same in french",
                "subtitle": "Subtitle.Updated",
                "details": "Details.Updated",
                "type": {
                    "id": 3,
                    "name": "Lien",
                    "alias": "link",
                    "category": "link"
                },
                "link": "https://lucca.fr/action/validate?id=1234",
                "status": "done",
                "icon": null,
                "payload": {
                    "external_id": "6042dbca-93a4-418e-b625-b7da58eaf6d4",
                    "module_name": "EPM_PERF_REVIEW",
                    "company_name": "Sfam",
                    "provider_name": "CSOD"
                },
                "effective_date": "2024-03-22 00:00:00",
                "delegated_from": null,
                "expires_at": "2024-03-22 00:00:00",
                "expired": true,
                "created_at": "2025-01-02 15:11:00",
                "updated_at": "2025-01-28 14:21:38"
            }
        }
    ]
}

In this case, the first action id is not found. The other is updated successfully.


Example input of complete failure 400 - error from the open-api-service #1:

{
    "data": [
        {
           "actionId": 1,
            "status": "non-valid-status",
            "category_action": "non-valid-category"
        },
        {
           
        },
          {
           "actionId": 5,
            "status": "non-valid-status"
        }
    ]
}

Response:

{
    "httpStatus": "BAD_REQUEST",
    "exceptionName": "ActionValidationException",
    "message": "Error(s) occurred. Checkout 'errors' for more details.",
    "errors": [
        "Action ID: '1' error - Unknown 'status' value: non-valid-status",
        "Action ID: '1' error - Unknown 'category_action' value: non-valid-category",
        "Action payload '#2' error - 'actionId' cannot be null, 0 or negative number",
        "Action ID: '5' error - Unknown 'status' value: non-valid-status"
    ],
    "timestamp": 1738309510540
}

Note: The request is validated on an open-API service level.

In this case, we may have multiple errors. No traffic to the core API will be generated.


Example input of complete failure 400 - error from the open-api-service #2:

{
    "data": [
        {
           "invalid_field_provided": "value_does_not_matter"
        }
    ]
}

Response:

{
    "httpStatus": "BAD_REQUEST",
    "exceptionName": "RequestValidationException",
    "message": "Error occurred: Bad Request. Details: Invalid request body",
    "timestamp": 1738310314798
}

This example shows the response when a non-valid field is provided. Again no traffic to the core API will be generated. Examples of all valid fields can be found in the create action response examples.


Another example of failure 400 - error from the core API:

{
  "data": [
    {
      "actionId": "19356",
      "status": "inactive"
    },
    {
      "actionId": "19355",
      "status": "inactive"
    }
  ]
}

Response:

{
  "status": "All update actions failed",
  "statistics": {
    "total": 2,
    "successCount": 0,
    "failureCount": 2
  },
  "actions": [
    {
      "actionId": 19356,
      "status": "error",
      "message": "400 Bad Request",
      "errors": {
        "status": [
          "The selected status is invalid."
        ]
      }
    },
    {
      "actionId": 19355,
      "status": "error",
      "message": "400 Bad Request",
      "errors": {
        "status": [
          "The selected status is invalid."
        ]
      }
    }
  ]
}

Another example of failure 404 - error from the core API:

{
  "data": [
    {
      "actionId": "19800",
      "status": "inactive"
    },
    {
      "actionId": "19801",
      "status": "inactive"
    }
  ]
}

Response:

{
  "status": "All update actions failed",
  "statistics": {
    "total": 2,
    "successCount": 0,
    "failureCount": 2
  },
  "actions": [
    {
      "actionId": 19800,
      "status": "error",
      "message": "No query results for model [App\\Models\\Action] 19800",
      "errors": null
    },
    {
      "actionId": 19801,
      "status": "error",
      "message": "No query results for model [App\\Models\\Action] 19801",
      "errors": null
    }
  ]
}

Last updated