Initiatives
GET /v1/initiatives
Model interface schema in TypeScript:
export interface Initiative {
/** Unique Id - ObjectId (24 character hex string) **/
_id: string,
/** Initiative name - Max: 255 characters **/
name: string,
/** Public image URL - Max: 2083 characters **/
profile?: string,
/** Parent id of the current node - ObjectId **/
parentId?: string;
/** ISO 8601 date string **/
created: Date
}List Initiatives
Allow to list all initiatives associated with connection initiativeId as flat list. It possible to recreate the tree structure by using parentId field.
Request
curl --location 'https://api.sg.g17.eco/v1/initiatives' \
--header 'Authorization: Bearer TOKEN_HERE'Response
{
"success": true,
"data": [
{
"_id": "6711c1f63a35b273a7998854",
"name": "Enterprise",
"created": "2024-10-18T02:03:34.131Z"
},
{
"_id": "67b4119993f3144ee0dad6bf",
"name": "North America",
"parentId": "6711c1f63a35b273a7998854",
"created": "2025-02-18T04:50:33.874Z"
},
{
"_id": "67b411a193f3144ee0dad6cc",
"name": "Europe",
"parentId": "6711c1f63a35b273a7998854",
"created": "2025-02-18T04:50:41.092Z"
},
// list continues...
]
}Get Tree
GET /v1/initiatives/tree
List all initiatives associated with connection initiativeId as tree structure.
Request
curl --location 'https://api.sg.g17.eco/v1/initiatives/tree' \
--header 'Authorization: Bearer TOKEN_HERE'Response
{
"success": true,
"data": {
"_id": "6711c1f63a35b273a7998854",
"name": "Enterprise",
"created": "2024-10-18T02:03:34.131Z",
"children": [
{
"_id": "67b4119993f3144ee0dad6bf",
"name": "North America",
"parentId": "6711c1f63a35b273a7998854",
"created": "2025-02-18T04:50:33.874Z",
"children": [
{
"_id": "67b411c593f3144ee0dad6e8",
"name": "United States",
"parentId": "67b4119993f3144ee0dad6bf",
"created": "2025-02-18T04:51:17.916Z",
"children": [
{
"_id": "67b411d893f3144ee0dad704",
"name": "Factories",
"parentId": "67b411c593f3144ee0dad6e8",
"created": "2025-02-18T04:51:36.973Z",
"children": [
{
"_id": "67b411e393f3144ee0dad712",
"name": "Factory #1",
"parentId": "67b411d893f3144ee0dad704",
"created": "2025-02-18T04:51:47.557Z",
"children": []
},
{
"_id": "67b411ec93f3144ee0dad720",
"name": "Factory #3",
"parentId": "67b411d893f3144ee0dad704",
"created": "2025-02-18T04:51:56.042Z",
"children": []
}
]
}
]
}
]
},
{
"_id": "67b411a193f3144ee0dad6cc",
"name": "Europe",
"parentId": "6711c1f63a35b273a7998854",
"created": "2025-02-18T04:50:41.092Z",
"children": []
}
]
}
}Get Surveys by Initiative
Similar to the list surveys endpoint, this endpoint returns a list of surveys for the specified initiativeId.
GET /v1/initiatives/:initiativeId/surveys
Request
curl --location 'https://api.sg.g17.eco/v1/initiatives/67b4119993f3144ee0dad6bf/surveys' \
--header 'Authorization: Bearer TOKEN_HERE'Response
{
"success": true,
"data": [
{
"_id": "62d9530ce3e05eca98c84663",
"period": "yearly",
"evidenceRequired": false,
"verificationRequired": false,
"type": "default",
"effectiveDate": "2022-07-21T13:22:20.575Z",
"utrvType": "actual",
"initiativeId": "67b4119993f3144ee0dad6bf",
"completedDate": "2022-07-21T14:42:55.087Z"
},
{
"_id": "6361eb2c1a6ad86071ce3304",
"name": "Q4 Reporting",
"period": "yearly",
"effectiveDate": "2022-12-31T23:59:59.999Z",
"utrvType": "actual",
"initiativeId": "67b4119993f3144ee0dad6bf",
"evidenceRequired": true,
"verificationRequired": false,
"type": "default",
"completedDate": "2023-05-09T07:29:05.643Z"
},
{
"_id": "63637694c60ea840343394b8",
"name": "Special report for last month",
"period": "yearly",
"effectiveDate": "2022-11-30T23:59:59.999Z",
"utrvType": "actual",
"initiativeId": "67b4119993f3144ee0dad6bf",
"evidenceRequired": true,
"verificationRequired": false,
"type": "default"
}
]
}You can filter the results using the optional changedSince query parameter to return only surveys where at least one question has been updated after the specified changedSince date.
changedSince filter
curl --location 'https://api.sg.g17.eco/v1/initiatives/67b4119993f3144ee0dad6bf/surveys?changedSince=2025-02-01' \
--header 'Authorization: Bearer TOKEN_HERE'{
"success": true,
"data": [
{
"_id": "6362124d1a6ad86071ce52a9",
"period": "yearly",
"effectiveDate": "2022-12-31T23:59:59.999Z",
"utrvType": "actual",
"initiativeId": "5bb4ab10e90adc12160dddae",
"evidenceRequired": true,
"verificationRequired": true,
"type": "default",
"lastUpdated": "2025-02-14T04:59:11.273Z"
},
]
}