Chilkat Online Tools

C# / Atlassian Confluence Cloud / Register modules

Back to Collection Items

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Chilkat.Http http = new Chilkat.Http();
bool success;

// Use this online tool to generate code from sample JSON: Generate Code to Create JSON

// The following JSON is sent in the request body.

// {}

Chilkat.JsonObject json = new Chilkat.JsonObject();

http.SetRequestHeader("Content-Type","application/json");

Chilkat.HttpResponse resp = http.PostJson3("https://your-domain.atlassian.net/wiki/rest/atlassian-connect/1/app/module/dynamic","application/json",json);
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Debug.WriteLine(Convert.ToString(resp.StatusCode));
Debug.WriteLine(resp.BodyStr);

Curl Command

curl -X POST
	-H "Content-Type: application/json"
	-d '"<object>"'
https://your-domain.atlassian.net/wiki/rest/atlassian-connect/1/app/module/dynamic

Postman Collection Item JSON

{
  "name": "Register modules",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "\"<object>\""
    },
    "url": {
      "raw": "{{baseUrl}}/atlassian-connect/1/app/module/dynamic",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "atlassian-connect",
        "1",
        "app",
        "module",
        "dynamic"
      ]
    },
    "description": "Registers a list of modules. For the list of modules that support dynamic registration, see [Dynamic modules](https://developer.atlassian.com/cloud/confluence/dynamic-modules/).\n\n**[Permissions](#permissions) required:** Only Connect apps can make this request."
  },
  "response": [
    {
      "name": "Returned if the request is successful.",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"webItems\": [\n        {\n            \"key\": \"my-webitem\",\n            \"location\": \"system.admin/globalsettings\",\n            \"url\": \"/my-web-item\",\n            \"name\": {\n                \"value\": \"My Web Item\"\n            }\n        }\n    ],\n    \"adminPages\": [\n        {\n            \"key\": \"my-admin-page\",\n            \"name\": {\n                \"value\": \"My Admin Page\"\n            },\n            \"url\": \"/my-admin-page\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/atlassian-connect/1/app/module/dynamic",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "atlassian-connect",
            "1",
            "app",
            "module",
            "dynamic"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Returned if:\n* any of the provided modules is invalid. For example, required properties are missing.\n* any of the modules conflict with registered dynamic modules or modules defined in the app descriptor. For example, there are duplicate keys.\n\nDetails of",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"webItems\": [\n        {\n            \"key\": \"my-webitem\",\n            \"location\": \"system.admin/globalsettings\",\n            \"url\": \"/my-web-item\",\n            \"name\": {\n                \"value\": \"My Web Item\"\n            }\n        }\n    ],\n    \"adminPages\": [\n        {\n            \"key\": \"my-admin-page\",\n            \"name\": {\n                \"value\": \"My Admin Page\"\n            },\n            \"url\": \"/my-admin-page\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/atlassian-connect/1/app/module/dynamic",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "atlassian-connect",
            "1",
            "app",
            "module",
            "dynamic"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "*/*"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Returned if the call is not from a Connect app.",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"webItems\": [\n        {\n            \"key\": \"my-webitem\",\n            \"location\": \"system.admin/globalsettings\",\n            \"url\": \"/my-web-item\",\n            \"name\": {\n                \"value\": \"My Web Item\"\n            }\n        }\n    ],\n    \"adminPages\": [\n        {\n            \"key\": \"my-admin-page\",\n            \"name\": {\n                \"value\": \"My Admin Page\"\n            },\n            \"url\": \"/my-admin-page\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/atlassian-connect/1/app/module/dynamic",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "atlassian-connect",
            "1",
            "app",
            "module",
            "dynamic"
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "*/*"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}