CA API Developer Portal: There was an error while creating the tenant
search cancel

CA API Developer Portal: There was an error while creating the tenant

book

Article ID: 97978

calendar_today

Updated On:

Products

CA API Developer Portal CA API Gateway

Issue/Introduction

When attempting to create a new tenant using the 'create-tenant.sh' script you may receive the below error:

'There was an error while creating the tenant. Please check your connection to the servers and/or your json payload.'

Environment

Release: 4.x
Component: APIPRD

Cause

This can be caused by several things:

1) The Portal name is not resolvable. You should ensure you can reach the portal name defined in the setup.

2) You had used a different "PORTAL_TENANT_ID" other than "apim" when running ./config.sh, the curl POST command inside the "create-tenant.sh" script fails.

3) You left out information when running the create-tenant.sh

Resolution

To resolve this:

1) Make sure the host is resolvable

curl -v <HostName> 

Additionally, please ensure you have followed the documentation to 'Configure Your DNS Server' prior to creating the tenant.

2) Be sure all data is filled in when running the script. Omitting items like the admin or reply email address will result in failures

3) Update the POST command in  "create-tenant.sh" script with the "PORTAL_TENANT_ID" which is set in portal.conf file, before executing  "create-tenant.sh" script.

Eg:- If "test" is the "PORTAL_TENANT_ID" which is configured in conf/portal.conf , then POST command in "create-tenant.sh" script will look like...

function create_tenant {
        apim=$(get_conf PORTAL_TENANT_ID)
        apim=${apim:-apim}
        if [ -z "$data" ]; then
                STATUSCODE=$(curl --silent --output ./tenant_info --write-out "%{http_code}" \
                                -X POST -k https://<TenantName>.${DOMAIN}:9443/provision/tenants \
                                --cert ${KEY_FILE} --key ${KEY_FILE} -H "Accept: application/json" \
                                -H "Content-Type: application/json" -d "$(generate_post_data)")
                if test $STATUSCODE -ne 201; then
                        echo "There was an error while creating the tenant. Please check your connection to the servers and/or your json payload."
                        exit 1
                else
                        print_steps
                fi
        elif [ -f "$data" ]; then
                STATUSCODE=$(curl --silent --output ./tenant_info --write-out "%{http_code}" \
                                -X POST -k https://<TenantName>.${DOMAIN}:9443/provision/tenants \
                                --cert ${KEY_FILE} --key ${KEY_FILE} -H "Accept: application/json" \
                                -H "Content-Type: application/json" -d @${data})
                if test $STATUSCODE -ne 201; then
                        echo "There was an error while creating the tenant. Please check your connection to the servers and/or your json payload."
                        exit 1
                else
                        print_steps
                fi
        else
                echo "${data} Does not exist"
        fi
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Update /etc/hosts file by adding an entry with the "PORTAL_TENANT_ID".

<IP>    <TenantName>

Substitute <IP> with the IP to your instance and example.com with "PORTAL_SUBDOMAIN" name accordingly.