I'm trying to create custom domains in Heroku through a controller action in my rails app. For now I just have a method in a controller to create the domains. I've been messing around with it for a few hours, but I keep getting either an unprocessable entity error or a 404 not found error.
Here's my code:
def create_custom_domain heroku = PlatformAPI.connect_oauth('[TOKEN]') heroku.domain.create('[APPNAME]', { hostname: "[www.abc.com]", sni_endpoint: "" }) redirect_to root_path end
I've also tried making the value of the sni_endpoint parameter null
because the docs say it's nullable, but that doesn't work either.
I've been using the Heroku api docs and I can't seem to figure out what's wrong. If anyone has any ideas, please let me know.
Here are the docs I've been looking at:
https://github.com/heroku/platform-api
https://heroku.github.io/platform-api/PlatformAPI/Domain.html
https://devcenter.heroku.com/articles/platform-api-reference#domain