Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor: update v2 resource update endpoints to use `PUT` method instead of `POST` (#5657)

Sanchith Hegde7f10678c36c5
diff --git a/api-reference-v2/api-reference/business-profile/business-profile--update.mdx b/api-reference-v2/api-reference/business-profile/business-profile--update.mdx
index eebd72dee6..36f556b3ee 100644
--- a/api-reference-v2/api-reference/business-profile/business-profile--update.mdx
+++ b/api-reference-v2/api-reference/business-profile/business-profile--update.mdx
@@ -1,3 +1,3 @@
---
-openapi: post /v2/profiles/{profile_id}
+openapi: put /v2/profiles/{profile_id}
---
diff --git a/api-reference-v2/api-reference/merchant-account/merchant-account--update.mdx b/api-reference-v2/api-reference/merchant-account/merchant-account--update.mdx
index f8511b81f8..274d7fad3d 100644
--- a/api-reference-v2/api-reference/merchant-account/merchant-account--update.mdx
+++ b/api-reference-v2/api-reference/merchant-account/merchant-account--update.mdx
@@ -1,3 +1,3 @@
---
-openapi: post /v2/accounts/{id}
+openapi: put /v2/accounts/{id}
---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/merchant-connector-account/merchant-connector--update.mdx b/api-reference-v2/api-reference/merchant-connector-account/merchant-connector--update.mdx
index f3cacd3bf5..6ccd052fb9 100644
--- a/api-reference-v2/api-reference/merchant-connector-account/merchant-connector--update.mdx
+++ b/api-reference-v2/api-reference/merchant-connector-account/merchant-connector--update.mdx
@@ -1,3 +1,3 @@
---
-openapi: post /v2/connector_accounts/{id}
+openapi: put /v2/connector_accounts/{id}
---
\ No newline at end of file
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 84711c7b35..e7a502be52 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -285,7 +285,7 @@
}
]
},
- "post": {
+ "put": {
"tags": [
"Merchant Connector Account"
],
@@ -509,7 +509,7 @@
}
]
},
- "post": {
+ "put": {
"tags": [
"Merchant Account"
],
@@ -662,7 +662,7 @@
}
]
},
- "post": {
+ "put": {
"tags": [
"Business Profile"
],
diff --git a/crates/openapi/src/routes/business_profile.rs b/crates/openapi/src/routes/business_profile.rs
index 1e948b1a63..ac0a4c6776 100644
--- a/crates/openapi/src/routes/business_profile.rs
+++ b/crates/openapi/src/routes/business_profile.rs
@@ -119,7 +119,7 @@ pub async fn business_profile_update() {}
///
/// Update the *business profile*
#[utoipa::path(
- post,
+ put,
path = "/v2/profiles/{profile_id}",
params(
("profile_id" = String, Path, description = "The unique identifier for the business profile")
diff --git a/crates/openapi/src/routes/merchant_account.rs b/crates/openapi/src/routes/merchant_account.rs
index 0ca6b15aab..7e5106d132 100644
--- a/crates/openapi/src/routes/merchant_account.rs
+++ b/crates/openapi/src/routes/merchant_account.rs
@@ -185,7 +185,7 @@ pub async fn update_merchant_account() {}
///
/// Updates details of an existing merchant account. Helpful in updating merchant details such as email, contact details, or other configuration details like webhook, routing algorithm etc
#[utoipa::path(
- post,
+ put,
path = "/v2/accounts/{id}",
request_body (
content = MerchantAccountUpdate,
diff --git a/crates/openapi/src/routes/merchant_connector_account.rs b/crates/openapi/src/routes/merchant_connector_account.rs
index 763c9f5f12..55c6d88aac 100644
--- a/crates/openapi/src/routes/merchant_connector_account.rs
+++ b/crates/openapi/src/routes/merchant_connector_account.rs
@@ -240,7 +240,7 @@ pub async fn connector_update() {}
/// To update an existing Merchant Connector account. Helpful in enabling/disabling different payment methods and other settings for the connector
#[cfg(feature = "v2")]
#[utoipa::path(
- post,
+ put,
path = "/v2/connector_accounts/{id}",
request_body(
content = MerchantConnectorUpdate,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 25e13ba417..4140978b36 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1133,7 +1133,7 @@ impl MerchantAccount {
.service(
web::resource("/{id}")
.route(web::get().to(retrieve_merchant_account))
- .route(web::post().to(update_merchant_account)),
+ .route(web::put().to(update_merchant_account)),
)
}
}
@@ -1186,7 +1186,7 @@ impl MerchantConnectorAccount {
.service(web::resource("").route(web::post().to(connector_create)))
.service(
web::resource("/{id}")
- .route(web::post().to(connector_update))
+ .route(web::put().to(connector_update))
.route(web::get().to(connector_retrieve))
.route(web::delete().to(connector_delete)),
);
@@ -1476,7 +1476,7 @@ impl BusinessProfile {
.service(
web::resource("")
.route(web::get().to(business_profile_retrieve))
- .route(web::post().to(business_profile_update)),
+ .route(web::put().to(business_profile_update)),
)
.service(
web::resource("/fallback_routing")