Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* Retrieves the details from the service endpoint defined for Mobile Center in VSTS
function getMobileCenterEndpointDetails(endpointInputFieldName) {
'use strict';
var errorMessage = "Can't decode endpoint.";
var endpoint = tl.getInput(endpointInputFieldName, true);
console.log(`Endpoint: ${endpoint}`);
if (!endpoint) {
throw new Error(errorMessage);
let url = tl.getEndpointUrl(endpoint, false);
console.log(`URL: ${url}`);
let apiServer = url.substr(0, url.lastIndexOf('/'));
console.log(`API Server: ${apiServer}`);
let apiVersion = url.substr(url.lastIndexOf('/') + 1);
console.log(`API Version: ${apiVersion}`);
var authToken = tl.getEndpointAuthorizationParameter(endpoint, 'apitoken', false);
if (!authToken)
console.log("NO AUTHTOKEN");
return {
apiServer: apiServer,
apiVersion: apiVersion,
authToken: authToken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment