Support » Plugin: Sermon Manager » REST API

  • Resolved rowan84

    (@rowan84)


    Hey team,

    Thanks so much for the great work that you do on the WP sermon manager plugin. It’s been working great for us. I want to try and automate sermon uploading based on mp3 uploads to Google Drive which syncs to a different server that we have.

    I saw that the plugin now supports REST API. I assume that this is the standard WordPress REST API? Which I have no idea how to use at this point. Is there some documentation on how to create sermon entries using this plugin via the REST API that is supported? Would really appreciate being pointed in any direction :).

Viewing 10 replies - 1 through 10 (of 10 total)
  • OK I found I can post to e.g. endpoint https://<site-url>/wp-json/wp/v2/wpfc_sermon

    but not sure what to include in the POST body

    Plugin Contributor Nikola

    (@nikolam)

    Hi,

    We’d recommend you to read the WordPress REST API Handbook, especially the part related to creating posts. (post will have to be replaced to wpfc_sermon for Sermon Manager, of course)

    Example request for Sermon Manager (with Basic Authenticationuse it only for testing!):
    curl -X POST http://<site_url>/wp-json/wp/v2/wpfc_sermon -d '{"title": "Sermon Test Title", "status": "publish", "sermon_description": "The description", "sermon_audio": "<full_url_to_mp3_file>"}' -u <username>:<password>

    (you can get full list of fields by opening http://<site_url>/wp-json/wp/v2/wpfc_sermon/<ID> (replace <ID> with some sermon ID))

    Let us know if you have more questions

    Thanks for the reply, however it doesn’t seem to work properly. I get a blank draft sermon in the wp-admin section once I post that request. And if I retrieve it via REST all the fields I set is also blank. Status is also set to draft even though I sent status as publish

    Plugin Contributor Nikola

    (@nikolam)

    Oops, I forgot to include the header. Just append -H 'Content-Type: application/json' to the curl command. (or set the header some other way in your app)

    Cool Thanks Nikola. That should have been obvious to me :). It works now, except for one thing i.e.the featured image. But now I think I know, this is set by the featured_media id.

    Can you perhaps point me in the right direction on uploading featured media images?

    From the plugin perspective is there any way you can take an external image url and make thumbnails etc etc. and upload as a featured image?

    OK so uploading an image via this: https://<site-url>/wp-json/wp/v2/wpfc_sermon/ enpoint works, and then saving the id returned in the response.

    I was hoping there would be a way to just provide a link to an external url on wordpress.

    Plugin Contributor Nikola

    (@nikolam)

    Seems like that’s the only way to do it.

    Reference: https://stackoverflow.com/a/38469742

    Ok, thanks again for all your help.

    Plugin Contributor Nikola

    (@nikolam)

    You are very welcome. 🙂

    Let us know if you have any other questions, or if you encounter any issues.

    Sermon Manager’s REST API isn’t much used, as far as we could tell, so there could be a random issue.

    OK cool, I’ve been testing with Postman, and seemed to work fine so far.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘REST API’ is closed to new replies.