SQL Server / Anypoint Platform APIs / Get all assets for organization by mulesoft
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
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
DECLARE @queryParams int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'search', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'types', 'api-group'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'types', 'connector'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'types', 'custom'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'types', 'example'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'types', 'extension'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'types', 'http-api'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'types', 'policy'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'types', 'raml-fragment'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'types', 'rest-api'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'types', 'soap-api'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'types', 'template'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'domain', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'organizationId', '{{mulesoft_org_id}}'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'masterOrganizationId', ''
EXEC sp_OAMethod @queryParams, 'UpdateInt', @success OUT, 'offset', 0
EXEC sp_OAMethod @queryParams, 'UpdateInt', @success OUT, 'limit', 20
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'sharedWithMe', ''
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'includeSnapshots', 'true'
-- Adds the "Authorization: Bearer {{token}}" header.
EXEC sp_OASetProperty @http, 'AuthToken', '{{token}}'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://domain.com/exchange/api/v2/assets', @queryParams
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 @queryParams
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 @queryParams
END
GO
Curl Command
curl -G -d "search="
-d "types=api-group"
-d "types=connector"
-d "types=custom"
-d "types=example"
-d "types=extension"
-d "types=http-api"
-d "types=policy"
-d "types=raml-fragment"
-d "types=rest-api"
-d "types=soap-api"
-d "types=template"
-d "domain="
-d "organizationId=%7B%7Bmulesoft_org_id%7D%7D"
-d "masterOrganizationId="
-d "offset=0"
-d "limit=20"
-d "sharedWithMe="
-d "includeSnapshots=true"
-H "Authorization: Bearer {{token}}"
https://domain.com/exchange/api/v2/assets
Postman Collection Item JSON
{
"name": "Get all assets for organization by mulesoft",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}",
"type": "text"
}
],
"url": {
"raw": "{{url}}/exchange/api/v2/assets?search=&types=api-group&types=connector&types=custom&types=example&types=extension&types=http-api&types=policy&types=raml-fragment&types=rest-api&types=soap-api&types=template&domain=&organizationId={{mulesoft_org_id}}&masterOrganizationId=&offset=0&limit=20&sharedWithMe=&includeSnapshots=true",
"host": [
"{{url}}"
],
"path": [
"exchange",
"api",
"v2",
"assets"
],
"query": [
{
"key": "search",
"value": ""
},
{
"key": "types",
"value": "api-group"
},
{
"key": "types",
"value": "connector"
},
{
"key": "types",
"value": "custom"
},
{
"key": "types",
"value": "example"
},
{
"key": "types",
"value": "extension"
},
{
"key": "types",
"value": "http-api"
},
{
"key": "types",
"value": "policy"
},
{
"key": "types",
"value": "raml-fragment"
},
{
"key": "types",
"value": "rest-api"
},
{
"key": "types",
"value": "soap-api"
},
{
"key": "types",
"value": "template"
},
{
"key": "domain",
"value": ""
},
{
"key": "organizationId",
"value": "{{mulesoft_org_id}}"
},
{
"key": "masterOrganizationId",
"value": ""
},
{
"key": "offset",
"value": "0"
},
{
"key": "limit",
"value": "20"
},
{
"key": "sharedWithMe",
"value": ""
},
{
"key": "includeSnapshots",
"value": "true"
}
]
}
},
"response": [
]
}