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

add new route to delete items #301

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

npracht
Copy link

@npracht npracht commented Feb 16, 2023

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/mautic-documentation#...
Related developer documentation PR URL mautic/developer-documentation#...
Issue(s) addressed Fixes #...

Description:

It was not possible to delete items by API. We introduce a new endpoint.

Steps to test this PR:

  1. Open this PR for testing locally (see docs on testing PRs here)
  2. use the API route delete Custom Items, GET /api/custom/item/delete/{itemId}

HTTP basic request example (using phpstorm):

POST http://localhost:8084/index_dev.php/oauth/v2/token
Accept: application/json,
Content-Type: application/json

{
    "client_id": "{{client_id}}",
    "client_secret": "{{client_secret}}",
    "grant_type": "client_credentials"
}

> {%
    client.global.set("auth_token", response.body.access_token);
%}

### Edit
PUT http://localhost:8084/index_dev.php/api/contacts/34690/edit
Content-Type: application/json
Authorization: Bearer {{auth_token}}

{
    "customObjects": {
        "data": [
            {
                "id": 2,
                "alias": "programmes",
                "data": [
                    {
                        "id": 18,
                        "name": "Hello From API2",
                        "attributes": {
                            "email": "[email protected]"
                        }
                    }
                ]
            }
        ]
    }
}

### Edit
GET http://localhost:8084/index_dev.php/api/custom/item/delete/19
Content-Type: application/json
Authorization: Bearer {{auth_token}}

@escopecz i think we need to add some of this info in the wiki as well, but it seems we cannot commit wiki code.

@Moongazer
Copy link

Would be super great if we'd be able to delete items via API, please merge and release.

Copy link
Contributor

@escopecz escopecz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add functional tests to get this 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.

4 participants