How to change SSL settings via Host API

Hi, I’ve added a host to my partner area using flarect and it’s working except for the endless redirect problem because (I presume) that it’s using Flexible SSL. I don’t want to disable SSL on my origin server so how do I use the Host API (particularly via flarectl if possible) to change the SSL setting from Flexible SSL to Full SSL, or even Full/Strict SSL?

If that is not possible via the partner Host API then how do I completely delete a zone via the Host API so I can try re-adding it again?

It seems I have some profound misunderstandings about how to use the various APIs let alone the right one to add zones to my partner account. I got this reply from a support ticket…

“Flarectl isn’t really meant to be used with Partner accounts. The reason is not showing up in your partners portal is that it was not signed up under a partners account. Flarectl just queries our client API, not the partners API, which is why you’re seeing different information here.”

So part of the reason some domains were added is because I started out using my own bash/curl script and THEN discovered flarectl on Github and thought that might save my a lot of time painfully trying to cobble together my own set of scripts.

Would anyone happen to know of any shell or PHP scripts that demonstrate how to use the Partner API?


Apologies for replying to my own post. It seems a lot of my initial confusion was because I had previously added the same email address years ago to the dash area and then recently to the partners area so depending on the API key I was adding domains to either the dash or partners.

To answer the specific OP question, I wrote this script which may be of use to others struggling with the Partner API for the first time…

#!/usr/bin/env bash
# .sh/bin/cfsettings 20181007 - 20181007
# Copyright (C) 1995-2018 Mark Constable <[email protected]> (AGPL-3.0)

# See setup-cf

[[ -z $1 || $1 =~ -h ]] && echo "Usage: cfsettings domain [key] [value]" && exit 1

[[ -z $CF_PARTNER_KEY ]] && echo "ERROR: CF_PARTNER_KEY is empty" && exit 2
[[ -z $CF_USER_KEY ]] && echo "ERROR: CF_USER_KEY is empty" && exit 3

ZONID=$(curl -s -X GET "$1" \
    -H "X-Auth-Email: $CF_PARTNER_EMAIL" \
    -H "X-Auth-Key: $CF_USER_API_KEY" \
    -H "Content-Type: application/json" \
    | jq -r '{"result"}[] | .[0] | .id')

[[ -z $ZONID ]] && echo "ERROR: $1 does not exist" && exit 4

if [[ $3 ]]; then
    curl -s -X PATCH "$ZONID/settings/$2" \
        -H "X-Auth-Email: $CF_PARTNER_EMAIL" \
        -H "X-Auth-Key: $CF_USER_API_KEY" \
        -H "Content-Type: application/json" \
        --data '{"value":"'$3'"}' | jq .
    curl -s -X GET "$ZONID/settings" \
        -H "X-Auth-Email: $CF_PARTNER_EMAIL" \
        -H "X-Auth-Key: $CF_USER_API_KEY" \
        -H "Content-Type: application/json" | jq -r '.result[] | [.id,.value]'
1 Like