Position Green API: Years

Modified on Mon, 24 Mar at 1:14 PM

This is an object representing a reporting year in Position Green. It is created by a Controller in Setup. The year has a start and an end date, they do not have to be the same as a calendar year or even 365 days. Overlapping years are allowed.


The year id is used to query other resources to identify which year the data is requested for.


Properties of a year object


PropertyData typeDescription
idGuidId of the year
namestringName of the year (can contain letters)
startDatestringStart date (ISO 8601, yyyy-mm-dd)
endDatestring

End date (ISO 8601, yyyy-mm-dd)



defaultboolIf the year is the default year for the reporters
visibleboolIf the year is visible for reporters
lockedboolNo changes to the data is allowed.


Get all years


GET https://api.positiongreen.com/v1/years

Returns all years


Query Parameters


NameTypeDescription
firstinteger

Limits the number of years in the result. Default 10. Minimum 1 and maximum 1000.

after

string



Cursor that points to where to continue retrieving years.
sortBystring'EndDate' or 'Name'. EndDate is default.
sortDirection

string

'Ascending' or 'Descending'. Ascending is default.



{
    "totalCount": 4,
    "pageInfo": {
        "hasNextPage": false,
        "startCursor": "aWR4OzA=",
        "endCursor": "aWR4OzM="
    },
    "items": [
        {
            "cursor": "aWR4OzA=",
            "node": {
                "id": "a689f723-ee83-4bd7-a186-bbd9aee9e8f2",
                "name": "2017",
                "startDate": "2017-01-01",
                "endDate": "2017-12-31",
                "default": false,
                "visible": true,
                "locked": false
            }
        },
        {
            "cursor": "aWR4OzE=",
            "node": {
                "id": "b424be42-90a6-45b3-9b41-c04c196bab20",
                "name": "2018",
                "startDate": "2018-01-01",
                "endDate": "2018-12-31",
                "default": false,
                "visible": true,
                "locked": true
            }
        },
        {
            "cursor": "aWR4OzI=",
            "node": {
                "id": "f4e14d1d-0e1f-4f67-8466-8bfb156d704a",
                "name": "2019",
                "startDate": "2019-01-01",
                "endDate": "2019-12-31",
                "default": false,
                "visible": true,
                "locked": true
            }
        },
        {
            "cursor": "aWR4OzM=",
            "node": {
                "id": "e821339f-9d6d-4f0e-9d0b-6452396befbd",
                "name": "2020",
                "startDate": "2020-01-01",
                "endDate": "2020-12-31",
                "default": true,
                "visible": true,
                "locked": false
            }
        }
    ]
}


Example: getting the first 2 years using curl


curl --request GET --header 'Authorization: Bearer <access token>' '<api-url>/years?first=


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article