Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- Use this online tool to generate code from sample JSON: Generate Code to Create JSON
-- The following JSON is sent in the request body.
-- {}
DECLARE @json int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @json OUT
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-Type', 'application/json'
DECLARE @resp int
EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://your-domain.atlassian.net/wiki/rest/atlassian-connect/1/app/module/dynamic', 'application/json', @json
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
RETURN
END
EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
PRINT @iTmp0
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @json
END
GO
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": ""
}
]
}