keep getEndpoints
external url is optional
fix select endpoint
format code