Skip to main content

Create or update suggestions

POST 

/api/v1/suggestions

Feed one event, or a batch of them, into a user's Suggested Entries.

This is the endpoint an integration uses: a calendar sync, a ticketing system, a badge reader — anything that knows a person spent time on something and wants Journyx to offer it as an entry.

POST is an upsert, not a create​

Suggestions are keyed on source_id within a source_category. Posting an event whose source_id has been seen before updates the existing suggestion rather than adding a second one.

That is what a feeder wants: re-sending yesterday's calendar after a meeting moved should correct the suggestion, not duplicate it. It also means you can re-run a sync safely — repeated events come back as unchanged.

Send no source_id and every POST creates a new suggestion, since there is nothing to match on.

One event or many​

Post a single event as the request body. Post many by naming them in a suggestions array. A bare JSON array at the top level is rejected.

The two modes answer differently, and it is a real difference:

Single eventBatch
Success201 Created with a Location header200 OK with item_results
BodyEmpty — read Location or uri for the new IDPer-item results and counts
A bad event400, nothing is storedThat item reports error; the rest are stored
predict defaulttruefalse

A single event in the suggestions array counts as a batch. If you want the batch response shape for one event, that is how to ask for it.

A batch is capped at 500 events by default; an administrator can change the limit. Exceeding it rejects the whole request with a 400 that names the maximum.

Reading the batch result​

A batch always answers 200, even when some events failed — the ones that succeeded really were stored, and no single status code describes a partial success. Check num_errors and the per-item status, not just the status code.

Note that unchanged is a success. A feed that re-sends the same events each hour should report almost nothing but unchanged, and treating that as a failure is a common mistake.

What you may set​

The event shape is flat: send id_project, not properties.id_project. Fields the engine owns — state, source_category, the audit fields, anything ending in _predict — are refused with a 400 naming them, rather than dropped silently, so a client finds out its write did not take. To pin a value the engine would otherwise guess, drop the _predict suffix.

Every event needs text to read and a start and end date; see the request schema for the exact requirements.

Suggesting for another user​

Set id_user. This needs a timekeeping ability over that user, and each distinct owner in a batch is authorized before anything is written — so a batch naming a user you cannot act for is refused whole, rather than partly applied.

Required abilities

Any authenticated user can create suggestions for themselves. Creating them for another user requires a timekeeping ability over that user. Over a Bearer token this needs the jx:suggestions:write scope, which the Suggest my entries connection level grants on its own — a feeder does not need access to the person's timesheets.

Request​

Responses​

A batch was processed. Some events may still have failed — check num_errors and the per-item status values.