function(apiId) {
        return new Promise(function(resolve, reject) {
            APIG.deleteRestApi({
                restApiId: apiId
            }, function(err) {
                if (err) {
                    if (err.code === 404 || err.code === 'NotFoundException') {
                        // API didn't exist to begin with
                        return resolve(apiId);
                    }

                    return reject(err);
                }

                resolve(apiId);
            });
        });
    }
function(apiId) {
        return new Promise(function(resolve, reject) {
            APIG.deleteRestApi({
                restApiId: apiId
            }, function(err) {
                if (err) {
                    if (err.code === 404 || err.code === 'NotFoundException') {
                        // API didn't exist to begin with
                        return resolve(apiId);
                    }

                    return reject(err);
                }

                resolve(apiId);
            });
        });
    }
function ( apiId ) { return new Promise ( function ( resolve , reject ) { APIG . deleteRestApi ( { restApiId : apiId } , function ( err ) { if ( err ) { if ( err . code === 404 || err . code === 'NotFoundException' ) { // API didn't exist to begin with return resolve ( apiId ) ; } return reject ( err ) ; } resolve ( apiId ) ; } ) ; } ) ; }
Delete the entire API ID

@return {Promise} which resolves to the ID of the API that was deleted
Delete the entire API ID