Skip to content

Commit

Permalink
CTC-2631 Add cURL samples for custom apps
Browse files Browse the repository at this point in the history
  • Loading branch information
jancerman committed Dec 3, 2024
1 parent 952d97d commit c19ce2a
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 4 deletions.
4 changes: 2 additions & 2 deletions net/management-api-v2/cm_api_v2_delete_custom_app.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

var client = new ManagementClient(new ManagementOptions
{
ApiKey = "<YOUR_API_KEY>",
ProjectId = "<YOUR_PROJECT_ID>"
ApiKey = "KONTENT_AI_MANAGEMENT_API_KEY",
EnvironmentId = "KONTENT_AI_ENVIRONMENT_ID"
});

var identifier = Reference.ById(Guid.Parse("f4b3fc05-e988-4dae-9ac1-a94aba566474"));
Expand Down
4 changes: 2 additions & 2 deletions net/management-api-v2/cm_api_v2_get_custom_app.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

var client = new ManagementClient(new ManagementOptions
{
ApiKey = "<YOUR_API_KEY>",
ProjectId = "<YOUR_PROJECT_ID>"
ApiKey = "KONTENT_AI_MANAGEMENT_API_KEY",
EnvironmentId = "KONTENT_AI_ENVIRONMENT_ID"
});

var identifier = Reference.ById(Guid.Parse("f4b3fc05-e988-4dae-9ac1-a94aba566474"));
Expand Down
3 changes: 3 additions & 0 deletions rest/management-api-v2/cm_api_v2_delete_custom_app.curl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
curl -X DELETE "https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/custom-apps/f4b3fc05-e988-4dae-9ac1-a94aba566474" \
-H "Authorization: Bearer KONTENT_AI_MANAGEMENT_API_KEY" \
-H "Content-Type: application/json"
3 changes: 3 additions & 0 deletions rest/management-api-v2/cm_api_v2_get_custom_app.curl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
curl -X GET "https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/custom-apps/f4b3fc05-e988-4dae-9ac1-a94aba566474" \
-H "Authorization: Bearer KONTENT_AI_MANAGEMENT_API_KEY" \
-H "Content-Type: application/json"
3 changes: 3 additions & 0 deletions rest/management-api-v2/cm_api_v2_get_custom_apps.curl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
curl -X GET "https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/custom-apps/" \
-H "Authorization: Bearer KONTENT_AI_MANAGEMENT_API_KEY" \
-H "Content-Type: application/json"
47 changes: 47 additions & 0 deletions rest/management-api-v2/cm_api_v2_patch_custom_app.curl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
curl -X PATCH "https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/custom-apps/f8f0b5cb-f5b7-42e8-af85-fbdab3ddfacf" \
-H "Authorization: Bearer KONTENT_AI_MANAGEMENT_API_KEY" \
-H "Content-Type: application/json" \
-d '[
{
"op": "addInto",
"property_name": "allowed_roles",
"value": [
{ "codename": "new_allowed_role_codename_to_be_add_into" }
]
},
{
"op": "remove",
"property_name": "allowed_roles",
"value": [
{ "codename": "allowed_role_codename_to_be_removed" }
]
},
{
"op": "replace",
"property_name": "name",
"value": "New Custom App Name"
},
{
"op": "replace",
"property_name": "codename",
"value": "new_custom_app_codename"
},
{
"op": "replace",
"property_name": "source_url",
"value": "https://newcustomapplication.net"
},
{
"op": "replace",
"property_name": "config",
"value": "{}"
},
{
"op": "replace",
"property_name": "allowed_roles",
"value": [
{ "codename": "allowed_role_codename" },
{ "id": "f8f0b5cb-f5b7-42e8-af85-fbdab3ddfacf" }
]
}
]'
17 changes: 17 additions & 0 deletions rest/management-api-v2/cm_api_v2_post_custom_app.curl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
curl -X POST "https://manage.kontent.ai/v2/projects/<YOUR_ENVIRONMENT_ID>/custom-apps/" \
-H "Authorization: Bearer KONTENT_AI_MANAGEMENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Custom App Name",
"codename": "custom_app_codename",
"source_url": "https://customapp.net",
"config": "{}",
"allowed_roles": [
{
"id": "7740a768-bfa5-4f64-bab4-d77cc0791d4c"
},
{
"id": "7a51d721-7302-4a85-b4ce-a6a3f3cce4a6"
}
]
}'

0 comments on commit c19ce2a

Please sign in to comment.