From c089660fc63040615d7a775af964c214eb7a6f0e Mon Sep 17 00:00:00 2001 From: Ikram Ul Haq Date: Thu, 5 Sep 2024 11:19:13 +0500 Subject: [PATCH] Add DELETE method in CAPIF API to delete the event subscriptions by its ID --- .../meep-app-enablement/server/capif-mgmt/service-mgmt.go | 4 ++-- go-apps/meep-app-enablement/server/routers.go | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go b/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go index 267d4694c..af23f8ea5 100644 --- a/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go +++ b/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go @@ -1119,7 +1119,7 @@ func applicationsSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) subId := vars["subscriptionId"] - appId := vars["appInstanceId"] + appId := vars["subscriberId"] mutex.Lock() defer mutex.Unlock() @@ -1153,7 +1153,7 @@ func applicationsSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { } // Validate subscription - if sub.Cfg.AppId != appId || sub.Cfg.Type != SER_AVAILABILITY_NOTIF_SUB_TYPE { + if sub.Cfg.AppId != appId { err = errors.New("Subscription not found") log.Error(err.Error()) errHandlerProblemDetails(w, err.Error(), http.StatusNotFound) diff --git a/go-apps/meep-app-enablement/server/routers.go b/go-apps/meep-app-enablement/server/routers.go index dcdc286e8..8f8ac2206 100644 --- a/go-apps/meep-app-enablement/server/routers.go +++ b/go-apps/meep-app-enablement/server/routers.go @@ -399,6 +399,13 @@ var routes = Routes{ capifMgmt.ApplicationsSubscriptionsPUT, }, + Route{ + "ApplicationsSubscriptionDELETE", + strings.ToUpper("Delete"), + "/capif-events/v1/{subscriberId}/subscriptions/{subscriptionId}", + svcMgmt.ApplicationsSubscriptionDELETE, + }, + Route{ "Index", "GET", -- GitLab