toggl / toggl_api_docs

Documentation for the Toggl API
1.4k stars 235 forks source link

Webhook subscription with enabled: false can't be deleted #439

Closed pixtron closed 2 years ago

pixtron commented 2 years ago

If a subscription is disabled, it can not be deleted. Only after setting the enabled flag to true it can be deleted.

Steps to reproduce

  1. curl -u {api_token}:api_token \
    -d '{
        "url_callback": "{url_callback}",
        "event_filters": [
            {"entity": "project", "action": "created"},
            {"entity": "tag", "action": "*"}
        ],
        "enabled": false,
        "description": "My first Webhooks subscription"
    }' \
    -H 'User-Agent: {user_agent}' \
    https://track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id} | jq .
  2. use subscription_id od subscription created in step 1.

curl -u {api_token}:api_token \
    -X DELETE \
    -H 'User-Agent: {user_agent}' \
    https://track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/{subscription_id} | jq .

3.

curl -u {api_token}:api_token \
    -H 'User-Agent: {user_agent}' \
    https://track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id} | jq .

Subscription created in step 1 is still in list, but should be deleted as step 2. returned a successfull result .

pixtron commented 2 years ago

Also updating a subscription wich has enabled: true does not work, if enabled flag in request body is either undefined or false.

SUBSCRIPTION_ID=123

curl -u {api_token}:api_token \
    -X PATCH \
    -d '{"enabled": false}' \
    -H 'User-Agent: {user_agent}' \
    https://track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/$SUBSCRIPTION_ID | jq .

curl -u {api_token}:api_token \
    -X PUT \
    -d '{
        "url_callback": "{url_callback}",
        "event_filters": [
            {"entity": "*", "action": "*"}
        ]
        "secret": "new secret string",
        "description": "New description"
    }' \
    -H 'User-Agent: {user_agent}' \
    https://track.toggl.com/webhooks/api/v1/subscriptions/{workspace_id}/$SUBSCRIPTION_ID | jq .

New secret and new description won't be updated.

joeriharleman commented 2 years ago

Hi Stefan,

Thank you for creating this issue on the repository. Unfortunately though, this repository is largely unmaintained and unwatched by our developers. On a positive note for you I can see that one of our developers has caught eye of it and mentioned it, but this process is not guaranteed to be followed up.

To keep track of the issue (pun intended? 🥲 ) and ensure follow-up, please submit your questions to our 24/5 dedicated support team here -> you can chat with them fairly directly using the chat icon in the bottom right corner. I promise you that you will have a better experience with our support team :)

Regards, Joeri