Api.json
Jump to navigation
Jump to search
The api.json file, is one of the special-purpose files in the event-catalogue. This file is used to specify which events can be whitelisted and optionally how the HTTP endpoint should behave.
File Format[edit | edit source]
The format for the file is
interface ApiConfig {
[event: string]: {
waitFor?: number,
}
}
Where waitFor
is in milliseconds. If a $reply
event is posted within that time it is returned to the caller, otherwise Queued job.
is returned. The default timeout is 5000 milliseconds (5 seconds).
In this example we have events get-data
and add-data
, the latter of which will wait for 2 seconds:
{
"get-data": { },
"add-data": { "waitFor": 2000 }
}
Deploying Recurring Events[edit | edit source]
When the event-catalogue is deployed, new events are automatically scheduled and removed events are cancelled. You can deploy the event-catalogue with the CLI:
mm deploy