» Admin Module Sharing API

There are two ways to configure module sharing via the admin API:

  • This endpoint, which allows an organization to share modules with a specific list of other organizations.
  • The update an organization endpoint, whose data.attributes.global-module-sharing property allows an organization to share modules with every organization in the instance.

Enabling either option will disable the other. For more information, see Administration: Module Sharing.

» Update an Organization's Module Consumers

PATCH /admin/organizations/:name/module-consumers

This endpoint sets the list of organizations that can use modules from the sharing organization's private registry. Sharing with specific organizations will automatically turn off global module sharing, which is configured with the update an organization endpoint (via the data.attributes.global-module-sharing property).

Parameter Description
:name The name of the organization whose registry is being shared
Status Response Reason
200 JSON API document (type: "module-partnerships") The list of module consumers was successfully updated
404 JSON API error object Organization not found or user unauthorized to perform action
422 JSON API error object Malformed request body (missing attributes, wrong types, etc.)

» Request Body

This PATCH endpoint requires a JSON object with the following properties as a request payload.

Key path Type Default Description
data.type string Must be "module-partnerships"
data.attributes.module-consuming-organization-ids array[string] A list of external ids for organizations that will be able to access modules in the producing organization's registry. These should have an org- prefix.

» Sample Payload

{
  "data": {
    "type": "module-partnerships",
    "attributes": {
      "module-consuming-organization-ids": [
        "org-939hp5K7kecppVmd"
      ]
    }
  }
}

» Sample Request

curl \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/vnd.api+json" \
  --request PATCH \
  --data @payload.json \
  https://tfe.example.com/api/v2/organizations/my-organization

» Sample Response

{
  "data": [
    {
      "id": "mp-tQATArr4gyYDBvkF",
      "type": "module-partnerships",
      "attributes": {
        "consuming-organization-id": "org-939hp5K7kecppVmd",
        "consuming-organization-name": "other-organization",
        "producing-organization-id": "org-etdex8r9VLnyHFct",
        "producing-organization-name": "my-organization"
      }
    }
  ]
}