set_endpoint function

Set endpoint