Get History
Retrieves the history of events for a given project and streak ID. Can be used for displaying the history of events in your app's UI, like on a calendar or timeline.
Endpoint
GET /events/:projectId/:streakId/history
Authentication
This endpoint requires API key authentication. See the Authentication for more information.
Parameters
Path Parameters
-
projectId
- (required)
- The ID of the project.
-
streakId
- (optional)
- The ID of the streak.
- Default is
default
.
Response
Fields
id
:string
- The unique identifier of the event.projectId
:string
- The ID of the project associated with the event.userId
:string
- The ID of the user associated with the event.streakId
:string
- The ID of the streak associated with the event.timestampISO
:string
- The timestamp of the event in ISO format.
NodeJS Example
import axios from 'axios';
const getHistory = async (projectId, streakId) => {
try {
const response = await axios.get(`https://api.streaksapi.com/events/${projectId}/history/${streakId}`, {
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
console.log('Event History:', response.data);
} catch (error) {
console.error('Error fetching event history:', error);
}
};
// Example usage
getHistory('123', '456');