Key Results endpoints

In the Gtmhub REST API Metrics is the programmatic name of Key Results. All endpoints listed in this section enable you to perform CRUD operations with Key Results.

🔗
get
/metrics
Gets all metrics in the current Gtmhub account.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
fieldsstringList of fields to be retrieved, separated by comas (,).
expected in query, sample value:
name,description
sortstringList of fields separated by comas (,). To invert a field's sort, you can prefix its name with a minus (-). For example, the following expression: sort=-name,dateCreated would return entities in reverse lexicographical order and then ordered by dateCreated.
expected in query, sample value:
-name,dateCreated
filterstringThe format of the parameter is inspired by the MongoDB query format. For example, the following expression {name: {$in: ["sales", "marketing"]}} would return all the entities that have name either "sales" or "marketing". This expression {"name":{$regex:".*Sales.*"}} would return entities that contain "Sales" in their names.
expected in query, sample value:
{name: {$in: ["sales", "marketing"]}}
skipintegerHow many entities to be skipped when executing a GET query. By default skip value is 0.
expected in query, sample value:
5
limitintegerThe max number of entities that can be returned by the GET query. By default take value is 100.
expected in query, sample value:
10
formattingstringThe formatting used for the description and custom fields of type text area. By default returned as 'mentionsMarkup'. Ex: "@[John Smith:[email protected]:602a65efc05575000123291b]". Use 'plainText' if you need the response to be returned without markdown and special markup. Ex: "@John Smith"
expected in query, sample value:
plainText
Expected response codes

curl -X GET 'https://app.gtmhub.com/api/v2/metrics?fields=name,description&sort=-name,dateCreated&filter={name: {$in: ["sales", "marketing"]}}&skip=5&limit=10&formatting=plainText' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v2/metrics?fields=name,description&sort=-name,dateCreated&filter={name: {$in: ["sales", "marketing"]}}&skip=5&limit=10&formatting=plainText", "method": "GET", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v2/metrics"



requests.get(url, headers = headers)
🔗
get
/metrics/checkin/{checkinId}
Gets a metric update (check-in) by checkin identifier (id).
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
checkinId
*
stringThe metric checkin identifier (id) / snapshot identifier (id).
expected in path
Expected response codes
200metricDto
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X GET 'https://app.gtmhub.com/api/v1/metrics/checkin/{checkinId}' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/metrics/checkin/{checkinId}", "method": "GET", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/metrics/checkin/{checkinId}"



requests.get(url, headers = headers)
{}
DEPRECATED
🔗
get
/metrics/owner/{ownerId}
Gets metrics (key results) by a specified owner identifier (id).
This method is deprecated. Use GET Key Results with ownerIds filter instead.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
ownerId
*
stringThe unique identifier of the owner (id).
expected in path
formattingstringThe formatting used for the description and custom fields of type text area. By default returned as 'mentionsMarkup' (Ex: "@[Mariya Velikova:[email protected]:602a65efc05575000123291b]"). Use 'plainText' if you need the response to be returned without markdown and special markup (Ex: "@Mariya Velikova").
expected in query, sample value:
string
Expected response codes
200metricsResponse
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X GET 'https://app.gtmhub.com/api/v1/metrics/owner/{ownerId}?formatting=string' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/metrics/owner/{ownerId}?formatting=string", "method": "GET", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/metrics/owner/{ownerId}"



requests.get(url, headers = headers)
{}
🔗
get
/metrics/{metricId}
Gets a metric (key result) by its unique identifier (id).
If the specified unique identifier is invalid, a 400 Bad Request Error occurs.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
metricId
*
stringThe unique identifier (id) of the metric.
expected in path
formattingstringThe formatting used for the description and custom fields of type text area. By default returned as 'mentionsMarkup' (Ex: "@[Mariya Velikova:[email protected]:602a65efc05575000123291b]"). Use 'plainText' if you need the response to be returned without markdown and special markup (Ex: "@Mariya Velikova").
expected in query, sample value:
string
Expected response codes
200metricDto
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X GET 'https://app.gtmhub.com/api/v1/metrics/{metricId}?formatting=string' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/metrics/{metricId}?formatting=string", "method": "GET", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/metrics/{metricId}"



requests.get(url, headers = headers)
{}
🔗
post
/metrics
Creates a new metric (key result) and attaches it to a goal.
If the metric is attached to a goal that belongs to a closed session, a 400 Bad Request Error occurs.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
metric
*
The object representing the metric to be created.
expected in body
Expected response codes
201metricDto
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X POST 'https://app.gtmhub.com/api/v1/metrics' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"metric":undefined}'

var body ='{"metric":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/metrics", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/metrics"

body = undefined;

requests.post(url, data=json.dumps(body), headers = headers)
{}
🔗
post
/metrics/checkins
Bulk create metric snapshots.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
snapshots
*
A list of objects representing the metric snapshots to be created.
expected in body
Expected response codes
200bulkCreateCheckinMetricResponse
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X POST 'https://app.gtmhub.com/api/v1/metrics/checkins' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"snapshots":undefined}'

var body ='{"snapshots":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/metrics/checkins", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/metrics/checkins"

body = undefined;

requests.post(url, data=json.dumps(body), headers = headers)
{}
🔗
post
/metrics/{metricId}/checkin
Updates the value of the manual metric (key result) specified in the url.
When trying to update a metric after its due date, a 400 Bad Request Error occurs.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
metricId
*
stringThe unique identifier (id) of the metric.
expected in path
checkIn
*
The object representing all metric attributes that can be updated when a metric is checked in.
expected in body
Expected response codes
201snapshotResponse
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X POST 'https://app.gtmhub.com/api/v1/metrics/{metricId}/checkin' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"checkIn":undefined}'

var body ='{"checkIn":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/metrics/{metricId}/checkin", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/metrics/{metricId}/checkin"

body = undefined;

requests.post(url, data=json.dumps(body), headers = headers)
{}
🔗
put
/goals/{id}/status
Updates a goal closed status.
Parameters
NameTypeDescription
Expected response codes
204no content
400bad request
403forbidden
404not found
500internal server error

curl -X PUT 'https://app.gtmhub.com/api/v1/goals/{id}/status' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \

var settings = { "url": "https://app.gtmhub.com/api/v1/goals/{id}/status", "method": "PUT", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/goals/{id}/status"



requests.put(url, headers = headers)
🔗
put
/metrics/{metricId}
Fully updates a metric (key result) in the current Gtmhub account.
Updates all metric's attributes with their corresponding values in metric request body.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
metricId
*
stringThe unique identifier (id) of the metric.
expected in path
metric
*
The values to update the metric with. If any of metric's attributes is missing from the request body the attribute is set to the zero value of its type.
expected in body
Expected response codes
200metricDto
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X PUT 'https://app.gtmhub.com/api/v1/metrics/{metricId}' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"metric":undefined}'

var body ='{"metric":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/metrics/{metricId}", "method": "PUT", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/metrics/{metricId}"

body = undefined;

requests.put(url, data=json.dumps(body), headers = headers)
{}
🔗
patch
/metrics/checkin/{checkinId}
Updates a metric checkin's comment. Does not update the check-in value.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
checkinId
*
stringThe metric checkin identifier (id) / snapshot identifier (id).
expected in path
snapshot
*
This object represents the attributes of a metric snapshot to be updated. In order to prevent metric history abuse, the only metric snapshot's attribute that can be updated is snapshot's comment.
expected in body
Expected response codes
204no content
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X PATCH 'https://app.gtmhub.com/api/v1/metrics/checkin/{checkinId}' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"snapshot":undefined}'

var body ='{"snapshot":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/metrics/checkin/{checkinId}", "method": "PATCH", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/metrics/checkin/{checkinId}"

body = undefined;

requests.patch(url, data=json.dumps(body), headers = headers)
🔗
patch
/metrics/{metricId}
Partially updates a metric in the current Gtmhub account.
Updates the metrics attributes that are specified in the metric request only. Any attributes that are not specified in the metric request will not be updated.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
metricId
*
stringThe unique identifier (id) of the metric.
expected in path
metric
*
The object representing the updated metric.
expected in body
Expected response codes
200metricDto
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X PATCH 'https://app.gtmhub.com/api/v1/metrics/{metricId}' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"metric":undefined}'

var body ='{"metric":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/metrics/{metricId}", "method": "PATCH", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/metrics/{metricId}"

body = undefined;

requests.patch(url, data=json.dumps(body), headers = headers)
{}
🔗
delete
/goals/{id}/status
Deletes a goal closed status.
Parameters
NameTypeDescription
Expected response codes
204no content
400bad request
403forbidden
404not found
500internal server error

curl -X DELETE 'https://app.gtmhub.com/api/v1/goals/{id}/status' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \

var settings = { "url": "https://app.gtmhub.com/api/v1/goals/{id}/status", "method": "DELETE", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/goals/{id}/status"



requests.delete(url, headers = headers)
🔗
delete
/metrics/checkin/{checkinId}
Deletes a metric update (also referred to as a snapshot or check-in).
This endpoint could be used by account admins only. No request object required.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
checkinId
*
stringThe metric checkin identifier (id) / snapshot identifier (id).
expected in path
Expected response codes
204no content
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X DELETE 'https://app.gtmhub.com/api/v1/metrics/checkin/{checkinId}' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/metrics/checkin/{checkinId}", "method": "DELETE", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/metrics/checkin/{checkinId}"



requests.delete(url, headers = headers)
🔗
delete
/metrics/{metricId}
Deletes the metric specified in the url from the current Gtmhub account.
No request object required.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
metricId
*
stringThe unique identifier (id) of the metric.
expected in path
Expected response codes
204no content
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X DELETE 'https://app.gtmhub.com/api/v1/metrics/{metricId}' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/metrics/{metricId}", "method": "DELETE", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/metrics/{metricId}"



requests.delete(url, headers = headers)