Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added API endpoint to delete and unlink custom items #363

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from

Conversation

shinde-rahul
Copy link

Q A
Bug fix? (use the a.b branch)
New feature/enhancement? (use the a.x branch) ✔️
Deprecations?
BC breaks? (use the c.x branch)
Automated tests included? ✔️❌
Related user documentation PR URL mautic/user-documentation#...
Related developer documentation PR URL mautic/developer-documentation-new#...
Issue(s) addressed Fixes #...

Description:

Added following endpoints,


Endpoint: Unlink Contact from Custom Item

Request Type: DELETE

URL: /api/custom/item/{item-id}/unlink/{contact-id}

Description:
This endpoint removes the association between a custom item and a contact in Mautic.

Parameters:

  • item-id (path parameter):
    The unique identifier for the custom item from which the contact will be unlinked.

  • contact-id (path parameter):
    The unique identifier for the contact to be unlinked from the custom item.

Headers:

  • Authorization:
    Required for authentication. Use Basic authorization with your encoded credentials.

    Authorization: Basic <encoded_credentials>
    

Example Request:

DELETE /api/custom/item/123/unlink/456 HTTP/1.1
Host: mautic.instace
Authorization: Basic YRasW90bWF1dTll

Response:

  • Success:

    • Status Code: 200 OK
  • Errors:

    • 404 Not Found: If either the item-id or contact-id does not exist.
    • 401 Unauthorized: If authentication credentials are missing or invalid.

Example Response:

{
  "success": true
}

Endpoint: Delete Custom Item

Request Type: DELETE

URL: /api/custom/item/{item-id}/delete

Description:
This endpoint permanently deletes a custom item from Mautic.

Parameters:

  • item-id (path parameter):
    The unique identifier of the custom item to be deleted.

Headers:

  • Authorization:
    Required for authentication. Use Basic authorization with your encoded credentials.

    Authorization: Basic <encoded_credentials>
    

Example Request:

DELETE /api/custom/item/123/delete HTTP/1.1
Host: mautic.instace
Authorization: Basic YRasW90bWF1dTll

Response:

  • Success:

    • Status Code: 200 OK
  • Errors:

    • 404 Not Found: If either the item-id does not exist.
    • 401 Unauthorized: If authentication credentials are missing or invalid.

Example Response:

{
  "success": true
}

Steps to test this PR:

  1. Open this PR for testing locally (see docs on testing PRs here)

@shinde-rahul
Copy link
Author

@escopecz @dadarya0 @fedys, please review this one.

@escopecz
Copy link
Contributor

@gunnrryy please take a look from the product perspective

@gunnrryy
Copy link
Contributor

gunnrryy commented Mar 6, 2025

@escopecz I think this is helpful addition to the product.

@escopecz
Copy link
Contributor

escopecz commented Mar 6, 2025

Thanks Yash@

@shinde-rahul please check the failing test. It needs an update of a GH action to a newer version. Please do so in this PR if you want to get this into the M4 version.

Also, write a documentation for these endpoints to the PR description so we could copy-paste it to https://github.com/acquia/mc-cs-plugin-custom-objects/wiki/API

@shinde-rahul shinde-rahul reopened this Mar 9, 2025
@shinde-rahul
Copy link
Author

@escopecz, Please help me with howtos for WIKI updates. I don't have permission to do that.

What exactly needs to be updated regarding the failing tests? I closed and reopened the PR, which is now awaiting approval.

@escopecz
Copy link
Contributor

@shinde-rahul you'll have to bump the version of the failing action:

uses: actions/upload-artifact@v3

I will copy-paste the docs from this PR description to the existing API docs in wiki once this gets merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants