Account Endpoints

/account/counters

Counters are integer-based values defined in the Backstack dashboard to store account-based statistics, such as tracking how often a feature is used.


Codebase implementation

Initiate a transaction on counters you want to track for future assessment.

// pseudocode

if (session.account.counters['foo-downloads'] === 10)
    <button>Get More Foos</button>
else
    <button onClick="downloadFoo()">Download Foo</button>

function downloadFoo() {
    const result = processDownload('foo-downloads');
    if (result.success) {
        updateFooDownloads(1);
    }
}

In the pseudocode above, the updateFooDownloads() function would update the foo-downloads counter.


Update a counter value

Counters are defined in the Backstack dashboard, and their transactions are managed in your codebase. The current app/session account.counters node contains an aggregate of their values.

POST /account/counters/:id/:integer

Update the current account foo-downloads counter:

# Add three
POST /account/counters/foo-downloads/3

# Subtract one
POST /account/counters/foo-downloads/-1

Reset a counter

Submit a delete request to reset the counter to zero.

DELETE /account/counters/foo-downloads
Previous
/account/change-account