Ask the user to approve a site, ahead of any call
OpenAPI JSONconst url = 'https://api.eu.apigami.com/requests';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"user_ref":"usr_3f9c1a0e7b2d4c58a61e9f0b2d7c4e13","install_ref":"ins_8b1e4f2a9c3d4e5f8a7b6c5d4e3f2a1b","targetDomain":"example.com"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.eu.apigami.com/requests \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "user_ref": "usr_3f9c1a0e7b2d4c58a61e9f0b2d7c4e13", "install_ref": "ins_8b1e4f2a9c3d4e5f8a7b6c5d4e3f2a1b", "targetDomain": "example.com" }'Opens the approval window for (your service, targetDomain) in a browser of the user named by user_ref, the one install_ref names or the one a call would use, unless the user already answered for that domain: approved, 200 with granted true and no window; refused, 403 no grant. Otherwise 200 means it is on screen; the answer is not returned here — the next call tells.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The user, as POST /connect/token returned it. The same for every app of your team; another team sees another value.
Optional: one browser of that user, as POST /connect/token or GET /v1/users/{user_ref}/installs returned it. Named, that browser is never replaced by another; left out, Apigami takes the most recently active browser of the user that can reach the site.
A bare host name, e.g. example.com. The site the user approved; subdomains are covered.
Responses
Section titled “Responses”The window is on screen, or the domain was already approved (granted true, no window).
object
Present and true when the user had already approved this domain; nothing was shown.
Examples
{ "ok": true}{ "ok": true, "granted": true}Malformed request.
object
Present and true when the approval window is open and the user has not answered within 45 s.
Example
{ "error": "targetDomain is required"}Missing, malformed or revoked API key.
object
Present and true when the approval window is open and the user has not answered within 45 s.
Example
{ "error": "bad client credentials"}Not allowed: the team has no active member, the user is not connected to this app, Apigami disabled their account, they left the team of your private app, install_ref is not one of this user’s browsers, or the user already refused this domain (no window opens).
object
Present and true when the approval window is open and the user has not answered within 45 s.
Examples
{ "error": "no grant"}{ "error": "client disabled"}{ "error": "not paired"}{ "error": "account disabled"}{ "error": "app is private"}{ "error": "install_ref is not a browser of this user"}The user_ref is not one of your team’s.
object
Present and true when the approval window is open and the user has not answered within 45 s.
Example
{ "error": "unknown user_ref"}No browser of the user can show the window: none is attached, or several are online and none is named.
object
Present and true when the approval window is open and the user has not answered within 45 s.
Example
{ "error": "no browser is attached to this user"}That browser cannot be reached. extension offline: the browser holds no connection right now. extension outdated: Apigami in that browser must be updated before it can connect again; Chrome installs the update on its own, and restarting Chrome applies it sooner.
object
Present and true when the approval window is open and the user has not answered within 45 s.
Examples
{ "error": "extension offline"}{ "error": "extension outdated"}