Error "Unable to decode playboook"

For feature requests, please see: https://mattermost.com/suggestions/.

For troubleshooting questions, please post in the following format:

Summary
I cannot create a playbook using the API.

Steps to reproduce
How can we reproduce the issue (what version are you using?)

I’ve converted the cURL request in the API docs to a Python Request and try use it to create a new playbook.

headers = {
    'Authorization': 'Bearer OOOO'
}


data = '{"title": "Cloud PlaybookRuns", "member_ids": [{"XXX"]},"team_id": "YYY","create_public_playbook_run": true,"reminder_timer_default_seconds": 10,"checklists": [{"title": "Triage issue","items": [{"title": "Gather information from customer."}]}]}'
response = requests.post('https://collab.enavvarje.se/plugins/playbooks/api/v0/playbooks', headers=headers, data=data)

Expected behavior
I would expect the get a new playbook. I’m at a loss to solve this as the same code worked on the preview instance i tried

Observed behavior
<Response [400]>
{“error”:“unable to decode playbook”}

Hi @mdb ,

there’s a problem with the syntax in your payload, this part of the JSON doesn’t validate:

It probably should read:

"member_ids": [ "XXX" ],

Can you check that?

thank you so much for that! bit embarrasing on my part.
However, once i changed that I now get that I am not authorized.

The same user can create playbooks in the web gui.

I reverted to just trying via cURL with this

curl -X POST 'https://collab.enavvarje.se/plugins/playbooks/api/v0/playbooks' -H 'Authorization: Bearer tokenjjj' -d '{"title": "Cloud PlaybookRuns", "description": "A playbook to follow when there is a playbook run regarding the availability of the cloud service.", "reminder_timer_default_seconds": 10, "team_id": "teamid","create_public_playbook_run": true,"checklists": [{"title": "Triage issue","items": [{"title": "Gather information from customer."}]}]}'

and get “not authorized” still. The same token can list playbooks via the api and create in the web gui… i’m sure it’s a detail i’m missing here

Hi again,

I just recognized that the API documentation for playbooks is in a pretty bad state, so you don’t even have a fair chance to get this fixed on your own :frowning: I was also unable to create a playbook using your payload on my local system, also always only got the Not authorized message until I found out that this is a licensing issue and you have to add the undocumented public parameter to the payload and set it to true.
Here are two examples of minimal payloads, the first one showing the Not authorized message and the second one working (creating a playbook without title, which is possible for whatever reason…):

{
  "team_id": "q44oy1r8s7ybxxo58zx4a5qmdr",
  "reminder_timer_default_seconds": 10
}

→ Not authorized.

{
  "team_id": "q44oy1r8s7ybxxo58zx4a5qmdr",
  "reminder_timer_default_seconds": 10,
  "public": true
}

→ Working

Thank you so much! Adding the public-parameter enabled me to create the playbook. However, this poses a new question that maybe this is the wrong forum-section for. But I’m running the team/free-version at this time. Is it not supposed to work in that version?

thanks

From what I found out, private playbooks seem to be a paid feature, but when I found out about the discrepancy today, I already alerted the docs team and am waiting for their feedback. As soon as I know what’s going on, I’ll let you know.

as long as i get a playbook via API i’m happy - doesn’t have to be private
thank you for alerting me to the public-paramter

cheers
martin

You’re welcome :slight_smile: Not sure how fast the feedback will come (if any) so I’m marking this issue as solved now. If I ever get more info, I’ll post it here.