Approve a channel consumer
const url = 'http://localhost:11044/api/v1/channels/consumers/example/example/grant';const options = {method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:11044/api/v1/channels/consumers/example/example/grant \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>'JSON fields: installationId, expectedRevision, sourceKind, sourceRevision. sourceKind host adds channelName and sourceId; sourceKind realm adds sourceRealm, sourceInstallationId and sourceName. A field from the other kind is refused.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Name of the captured realm installed in the signed-in owner’s world; non-blank, at most 256 UTF-8 bytes, no control characters and not all * (400 otherwise). 409 when its live installation is not the one named by the body’s installationId and expectedRevision
Consumer the realm declares that is to read the source the body names, replacing any source it read before; same text rules as the realm name. 400 when undeclared, when the source kind does not fit its declaration, or when its handler cannot be approved
Responses
Section titled “Responses”OK
One channel consumer a captured realm declares, and the source the owner approved it to read; answered by the /channels/consumers/{realmName} list, grant and revoke routes
object
Name of the realm handler the consumer runs
Whether that handler is approved on the installation; a consumer cannot be approved until it is
The live installation of that realm this was read from; send it back as installationId on a change
Name of the consumer, as the realm declares it
Name of the realm that declares the consumer
That installation’s revision; send it back as expectedRevision on a change
The source the consumer is approved to read; null while it is not approved
object
For host, the host channel’s source id; for realm, the installation id of the realm that produces the source
One of host (a host channel) or realm (a realm’s event source)
Name of the realm that produces the source; null for a host channel
For host, the host channel approval’s revision; for realm, the event source grant’s revision, which moves independently of the installation’s revision
Name of the event source within that realm; null for a host channel

