access
POST /v1/sites/{siteId}/collaborators
Share this site with one person.
සත්යාපනය
බෙරර් ටෝකනයක් ලෙස API යතුරක් යවන්න. මෙම අන්ත ලක්ෂ්යය පිරිවිතරයේ නිශ්චිත අවසරයක් දක්වා නැත, එබැවින් උපකල්පනය කරනවාට වඩා ඔබේ යතුරට අවශ්ය අවම අවසරය ලබා දී ප්රතිචාරය පරීක්ෂා කරන්න.
මෙම අවසාන ලක්ෂ්යය සඳහා සංවිධාන හැඳුනුම්පතක් (organisation id) අවශ්ය නොවේ. ඔබගේ යතුර මඟින් එය අයත් වන සංවිධානය දැනටමත් හඳුනා ගන්නා අතර, ප්රතිචාරය ඒ වෙත සීමා වේ.
උත්සාහ කරන්න
<අගයන්> සමඟ කෝණික වරහන් තුළ ඇති ඕනෑම දෙයක් සහ ඔබේ උපකරණ පුවරුවෙන් ලබාගත් යතුරක් සමඟ key ස්ථාන දායකය ප්රතිස්ථාපනය කරන්න.
curl -X POST https://api.zinndigital.com/v1/sites/{siteId}/collaborators \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "email": <string>, "role": <SiteCollaboratorRole>, "reason": <string> }'පද්ධතියට පිවිස සිටිනවාද? ඔබගේ උපකරණ පුවරුවේ ඇති API කොන්සෝලය මඟින් ඔබේ සැබෑ ආයතනික හැඳුනුම්පත සහ ඔබේම යතුර පුරවා, සජීවී API වෙත ඉල්ලීම ක්රියාත්මක කරන බැවින් ඔබට සැබෑ ප්රතිචාරය දැකගත හැක. මෙම අග්රලක්ෂ්යය API කොන්සෝලය තුළ විවෘත කරන්න
විස්තර
Grants one person access to this one site at one role, optionally until a date, and gives them the narrow site_collaborator organisation membership if they have none. The narrowing is enforced by Postgres row-level security on the site table itself, not by a filter in a query, so it applies to every endpoint on this API rather than to the ones somebody remembered. ⭐ The person need not have an account yet. An address nobody has signed in as is invited in the same call: an ordinary organisation invitation is sent at the site_collaborator role, and the grant is returned with status: pending and a null user_id. The moment they accept — which proves control of that inbox through the identity provider, so no id is ever guessed — the grant activates for that person. A pending grant narrows nobody: nothing is reachable until the accept. If the address already holds a pending invitation to the whole organisation the call is refused with SITE_COLLABORATOR_ALREADY_INVITED rather than quietly downgrading that invitation to one site. What a collaborator may then do is the per-site role, on that site only. A request whose path names a granted site is evaluated with the role's keys (viewer reads; editor adds hosting.deploy.manage, sites.cache.purge, hosting.performance.manage, sites.wp_login, sites.panel_access, sites.restart, hosting.php.manage; manager adds hosting.backup.manage, hosting.ssl.manage, hosting.cdn.manage, hosting.applications.manage, hosting.import.manage). A request naming any other site answers 404, and a request naming no site — the collection endpoints and every organisation-level surface such as members, API keys and billing — carries only sites.view, so it is refused with 403. Revoking a grant takes effect on the next request, whatever token the person is holding. Every refusal carries its OWN error.code, because the status says what happened and only the code says what to do about it. 409 is about the world: SITE_COLLABORATOR_ALREADY_GRANTED (this person already has a live or pending grant here), SITE_COLLABORATOR_ALREADY_A_MEMBER (they are already an unrestricted member, so a grant would imply a restriction we are not applying — a lie in an access table) and SITE_COLLABORATOR_ALREADY_INVITED (above). 422 is about the request: SITE_COLLABORATOR_EXPIRY_IN_THE_PAST and SITE_COLLABORATOR_REASON_REQUIRED. ⛔ Key on the code, never on error.message. The message is a sentence written for a person and it is translated; the code is the contract.
පරාමිතීන්
| නම | වර්ගය | අත්යවශ්යයි | එය කුමක්ද |
|---|---|---|---|
siteId (path) | Uuid | ඔව් | Site ID (UUIDv7). |
ඉල්ලුම් පත්ර ශරීරය
| නම | වර්ගය | අත්යවශ්යයි | එය කුමක්ද |
|---|---|---|---|
email | string | ඔව් | The person to share with. An address with no account here is invited in the same call and the grant is returned pending — see the endpoint description. |
role | SiteCollaboratorRole | ඔව් | What a collaborator may do on the site they were granted. viewer reads it; editor adds the day-to-day work (deploys, cache, plugins, staging); manager adds the structural… |
reason | string | ඔව් | Why they are being given this site. Required rather than optional: an optional reason is one nobody fills in, and the audit value of the record collapses to… |
expires_at | object | නැත | Optional automatic end. Null means until revoked. A time in the past is refused with expiry_in_the_past rather than silently creating a dead grant. |
පsspil
| නම | වර්ගය | අත්යවශ්යයි | එය කුමක්ද |
|---|---|---|---|
id | string | ඔව් | — |
site_id | string | ඔව් | — |
user_id | object | ඔව් | The collaborator, once known. Null while the grant is pending — the address has been invited and nobody has signed in as it yet. |
email | string | ඔව් | — |
role | SiteCollaboratorRole | ඔව් | What a collaborator may do on the site they were granted. viewer reads it; editor adds the day-to-day work (deploys, cache, plugins, staging); manager adds the structural… |
reason | string | ඔව් | Why this person was given this site. Required on creation, and returned here because a year later it is the only thing that can answer "why does this person have my site?". |
granted_by | string | ඔව් | The audit ref of whoever granted it, user:<id>. |
created_at | string | ඔව් | — |
expires_at | object | ඔව් | When the grant lapses on its own, or null for until revoked. Evaluated at read time, so it takes effect on the clock rather than when a sweep next runs. |
active | boolean | ඔව් | Neither revoked nor past its expiry, as of this response. |
status | string<pending, active, expired, revoked> | ඔව් | pending — invited, waiting for the person to sign in as that address; active — in force now; expired — lapsed on its own end date; revoked — ended by the owner, the row… |
මෙම අවසාන ලක්ෂ්යය ආපසු ලබා දිය හැකි දෝෂ
401 · 403 · 404 · 409 · 422 · 429