Stores a connection for the caller's profile, in one of two ways.
- Exchange
{location, code, state}: exchanges thecodefrom the redirect for tokens, which are stored server-side and never returned. The connection is shared across profiles (Box only) exactly whenshare: truewas sent toinitiate: the choice is read from the signedstate. Asharesent here is optional and must repeat that choice, or the request answers400. - Link
{location: 3, shared_connection_id}: links the profile to a shared Box connection listed byGET /media_storage/connections/shared. The id must be a shared token of the same provider.
Either way the profile's previous connection to that provider is replaced. Creating a connection does not change the profile's active media storage location.
For Dropbox the legacy ZCCompanyInfo Dropbox columns are kept in step with the stored connection.
Authorization
Internal clients only, and a SERVER or COMPANY user. A state minted with share: true needs a SERVER user here too.
Responses
-
Created - the connection as
GETlists it. -
Bad Request - unsupported
location; missingcode;stateinvalid, expired, or minted for another location, profile or server;sharesent and different from the valuestatewas minted with;shared_connection_idsent withcode,stateorshare, sent for a location other than 3, or not a linkable id (Parameter 'shared_connection_id' is invalid, the same message for an unknown id, a token that is not shared, and a token of another type); or the provider rejected the code. -
Unauthorized - missing or invalid bearer token.
-
Forbidden - the client is not an internal client, the token belongs to a BASIC user, or
statewas minted withsharetrue and the user is not a SERVER user. -
Bad Gateway - the provider failed or rejected this server's client credentials.
-
Service Unavailable - the provider has no OAuth client credentials on this server.
curl \
--request POST 'https://api.iformbuilder.com/exzact/api/v81/[servername]/media_storage/connections' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer {access_token}" \
--data '{
"location": 3,
"code": "4c5f1b0a9e",
"state": "eyJsb2NhdGlvbiI6M30.5d41402abc4b2a76b9719d911017c592"
}'
{
"location": 3,
"code": "4c5f1b0a9e",
"state": "eyJsb2NhdGlvbiI6M30.5d41402abc4b2a76b9719d911017c592"
}
{
"provider": "box",
"location": 3,
"active": false,
"account": "Jane Example"
}