This small sample program demonstrated how to create and delete VSTS service endpoints by using the VSTS REST API.
Depending on the service endpoint type, you might need to set other properties. You can find documentation of the different endpoint types here.
You can also programmatically read out the endpoint types using the REST API as described here.
Good luck, Tom!