Skip to main content

Update a suggestion

PUT 

/api/v1/suggestions/:id_suggestion

Change an existing suggestion: correct the event, pin an entry code, or dismiss and restore it.

This PUT merges; it does not replace

Journyx PUT normally replaces a resource with the body you send. This endpoint does not. It is the one place in the API where that differs, so it is worth reading before you write a client against it.

Concretely:

  • A field your body does not mention keeps its stored value. There is no need to read the suggestion, edit it, and send the whole thing back.
  • An entry-code field that already holds a value is not blanked by sending it empty. To change one, send the new value; to clear one, you will need to delete the suggestion and re-create it.
  • subtype is re-derived on every write, so a value you send may be replaced by the one the engine computes.

The reason is that a write goes through the same intake path the calendar feeders use, and merging is what a feeder needs — a calendar that omits a field is not asserting it is empty. Rather than give this endpoint a second, divergent write path, it shares the feeders' one and documents the difference.

Every write needs the event's dates​

Intake re-reads the dates on each write, so an update carrying event fields must include a start and end pair even though the stored suggestion already has them. Omitting them is a 400.

The exception is a body carrying only dismissed: that changes the disposition without going through intake at all, so it needs nothing else. This is the cheap, common case — a user setting a suggestion aside.

Dismissing and restoring​

dismissed is the only disposition a client may set. Send true to set the suggestion aside, false to bring it back.

actualized is read-only — it is set when someone accepts the suggestion into a real entry — and sending it is a 400.

Concurrency​

As with all PUT modifications, you must include the If-Match header with the current ETag value of the user record or the request will fail with a "412 Precondition Failed" status code. The ETag value can be obtained by retrieving the item with a GET request and examining the ETag header in the response.

Expect 412 here more often than on other resources. The Suggestion Engine rewrites suggestions in the background — a calendar refresh or an entry-screen load re-predicts them — so an ETag can go stale without anyone touching the API. Treat 412 as routine: re-GET, re-apply your change, and retry. The ETag on the PUT response is already refreshed, so a chain of edits needs no intervening GET.

Required abilities

Your own suggestions, or those of a user you hold a timekeeping ability over. Over a Bearer token this needs the jx:suggestions:write scope.

Request​

Responses​

The suggestion was updated. The response body is empty; the ETag header carries the refreshed value, so you can chain further edits without another GET.

Response Headers
    Location

    URI of the object

    ETag

    The current ETag value for this object, which is needed to perform a PUT modification.

    See the modifying objects guide and the related tutorial section.