Ckan: api - send_email_notifications does not accept POST

Created on 15 Mar 2019  Â·  6Comments  Â·  Source: ckan/ckan

CKAN Version if known (or site URL)

2.8.2

Please describe the expected behaviour

send_email_notifications proceeds on api action POST

Please describe the actual behaviour

curl -H "Content-Type: application/json" -H "X-CKAN-API-Key:40ba51c5-8677-40b5-91a7-7c8d1905303a" -X POST http://ckan:5000/api/3/action/send_email_notifications

"Requ\u00eate incorrecte - Erreur JSON : Invalid request. Please use POST method for your request"

Most helpful comment

Oh I missed that. It's not apparent in the actual api docs though, outside of the cron job. Here I
am trying to patch core and all that's necessary might be a docs update

On Wed, Mar 20, 2019, 21:44 ThrawnCA <[email protected] wrote:

Note that the manual
https://docs.ckan.org/en/2.8/maintaining/email-notifications.html
advises you to post empty braces:

echo '{}' | /usr/lib/ckan/bin/paster --plugin=ckan post -c /etc/ckan/production.ini /api/action/send_email_notifications

Which works for us.

But providing a default value is good too.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ckan/ckan/issues/4688#issuecomment-475097058, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AB0YylIV_2oGfvnclPeoiiRJ8Fb0xtKCks5vYvIKgaJpZM4b2yQU
.

All 6 comments

Is your request being redirected (and turned into a GET request?) curl -v should tell you.

@fvanderbiest Replicated in 2.7. Found the issue and working on a PR.

@fvanderbiest @LukeTully Here's an initial fix, but the surrounding code hasn't been touched in a while and it's late af here so I'm not issuing PR just yet. It's also a change that is backportable super far because it's just in the main api and present in all versions from what I can tell. Have to wonder how send_email_notifications was working at all.

Note that the manual advises you to post empty braces:

echo '{}' | /usr/lib/ckan/bin/paster --plugin=ckan post -c /etc/ckan/production.ini /api/action/send_email_notifications

Which works for us.

But providing a default value is good too.

Oh I missed that. It's not apparent in the actual api docs though, outside of the cron job. Here I
am trying to patch core and all that's necessary might be a docs update

On Wed, Mar 20, 2019, 21:44 ThrawnCA <[email protected] wrote:

Note that the manual
https://docs.ckan.org/en/2.8/maintaining/email-notifications.html
advises you to post empty braces:

echo '{}' | /usr/lib/ckan/bin/paster --plugin=ckan post -c /etc/ckan/production.ini /api/action/send_email_notifications

Which works for us.

But providing a default value is good too.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ckan/ckan/issues/4688#issuecomment-475097058, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AB0YylIV_2oGfvnclPeoiiRJ8Fb0xtKCks5vYvIKgaJpZM4b2yQU
.

Although the api could use some refactoring anyway.

On Wed, Mar 20, 2019, 23:51 Luke Tully <[email protected] wrote:

Oh I missed that. It's nit reflected in the actual api docs though. Here I
am trying to patch core and all that's necessary might be a docs update

On Wed, Mar 20, 2019, 21:44 ThrawnCA <[email protected] wrote:

Note that the manual
https://docs.ckan.org/en/2.8/maintaining/email-notifications.html
advises you to post empty braces:

echo '{}' | /usr/lib/ckan/bin/paster --plugin=ckan post -c /etc/ckan/production.ini /api/action/send_email_notifications

Which works for us.

But providing a default value is good too.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ckan/ckan/issues/4688#issuecomment-475097058, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AB0YylIV_2oGfvnclPeoiiRJ8Fb0xtKCks5vYvIKgaJpZM4b2yQU
.

Was this page helpful?
0 / 5 - 0 ratings