You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ma...@apache.org on 2020/03/25 13:56:53 UTC

[trafficcontrol] branch master updated: Collapse cdns/{{ID}}/snapshot & snapshot/{{CDN}} to snapshot route (#4517)

This is an automated email from the ASF dual-hosted git repository.

mattjackson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 96769b6  Collapse cdns/{{ID}}/snapshot & snapshot/{{CDN}} to snapshot route (#4517)
96769b6 is described below

commit 96769b695081250e5d42c2afafd2073e0ea562bf
Author: Michael Hoppal <54...@users.noreply.github.com>
AuthorDate: Wed Mar 25 07:56:45 2020 -0600

    Collapse cdns/{{ID}}/snapshot & snapshot/{{CDN}} to snapshot route (#4517)
    
    * Collapse cdns/{{ID}}/snapshot & snapshot/{{CDN}} to snapshot route
    
    * Move to_access to new snapshot endpoint
    
    * Use common function
---
 CHANGELOG.md                                       |  3 +
 docs/source/api/v1/cdns_id_snapshot.rst            | 21 +++++--
 docs/source/api/v1/snapshot_name.rst               | 21 +++++--
 docs/source/api/v2/cdns_id_snapshot.rst            | 66 ----------------------
 .../api/v2/{snapshot_name.rst => snapshot.rst}     | 39 ++++++++-----
 .../cdn-in-a-box/traffic_ops/to-access.sh          |  2 +-
 .../clients/python/trafficops/tosession.py         | 12 ++--
 traffic_ops/traffic_ops_golang/crconfig/handler.go | 51 ++++++++++++-----
 traffic_ops/traffic_ops_golang/routing/routes.go   |  7 +--
 traffic_portal/app/src/common/api/CDNService.js    |  2 +-
 10 files changed, 110 insertions(+), 114 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 45d91cd..ee75a96 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
   - /api/2.0/vault/ping `GET`
   - /api/2.0/vault/bucket/:bucket/key/:key/values `GET`
   - /api/2.0/servercheck `GET`
+  - /api/2.0/snapshot `PUT`
 
 ### Changed
 - Fix to traffic_ops_ort.pl to strip specific comment lines before checking if a file has changed.  Also promoted a changed file message from DEBUG to ERROR for report mode.
@@ -60,6 +61,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
   - /cdns/:name/federations/:id (GET)
   - /cdns/configs
   - /cdns/:id (GET)
+  - /cdns/:id/snapshot
   - /cdns/name/:name (GET)
   - /cdns/usage/overview
   - /deliveryservice_matches
@@ -97,6 +99,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
   - /servers/status
   - /servers/:id (GET)
   - /servers/totals
+  - /snapshot/:cdn
   - /stats_summary/create
   - /tenants/:id (GET)
   - /statuses/:id (GET)
diff --git a/docs/source/api/v1/cdns_id_snapshot.rst b/docs/source/api/v1/cdns_id_snapshot.rst
index 0d4056e..6e0793b 100644
--- a/docs/source/api/v1/cdns_id_snapshot.rst
+++ b/docs/source/api/v1/cdns_id_snapshot.rst
@@ -18,6 +18,8 @@
 ************************
 ``cdns/{{ID}}/snapshot``
 ************************
+.. deprecated:: ATCv4
+	Use the ``PUT`` method of :ref:`to-api-snapshot` with the query parameter ``cdnID`` instead.
 
 ``PUT``
 =======
@@ -58,9 +60,20 @@ Response Structure
 	Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
 	Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
 	Access-Control-Allow-Origin: *
+	Content-Encoding: gzip
+	Content-Type: application/json
 	Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 GMT; Max-Age=3600; HttpOnly
-	Whole-Content-Sha512: z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==
+	Whole-Content-Sha512: gmaWI0tKgNFPYO0zMrLCGDosBJkPbeIvW4BH9tEh96VjBqyWqzjgPySoMa3ViM1BQXA6VAUOGmc76VyhBsaTzA==
 	X-Server-Name: traffic_ops_golang/
-	Date: Wed, 12 Dec 2018 22:04:46 GMT
-	Content-Length: 0
-	Content-Type: text/plain; charset=utf-8
+	Date: Wed, 18 Mar 2020 15:51:48 GMT
+	Content-Length: 160
+
+	{
+		"alerts": [
+			{
+				"text": "This endpoint is deprecated, please use PUT /snapshots with either the query parameter cdn or cdnID instead",
+				"level": "warning"
+			}
+		],
+		"response": "SUCCESS"
+	}
\ No newline at end of file
diff --git a/docs/source/api/v1/snapshot_name.rst b/docs/source/api/v1/snapshot_name.rst
index 36b8ae6..f02230f 100644
--- a/docs/source/api/v1/snapshot_name.rst
+++ b/docs/source/api/v1/snapshot_name.rst
@@ -18,6 +18,8 @@
 *********************
 ``snapshot/{{name}}``
 *********************
+.. deprecated:: ATCv4
+	Use the ``PUT`` method of :ref:`to-api-snapshot` with the query parameter ``cdn`` instead.
 
 ``PUT``
 =======
@@ -58,9 +60,20 @@ Response Structure
 	Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
 	Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
 	Access-Control-Allow-Origin: *
+	Content-Encoding: gzip
+	Content-Type: application/json
 	Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 GMT; Max-Age=3600; HttpOnly
-	Whole-Content-Sha512: z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==
+	Whole-Content-Sha512: gmaWI0tKgNFPYO0zMrLCGDosBJkPbeIvW4BH9tEh96VjBqyWqzjgPySoMa3ViM1BQXA6VAUOGmc76VyhBsaTzA==
 	X-Server-Name: traffic_ops_golang/
-	Date: Wed, 12 Dec 2018 22:00:18 GMT
-	Content-Length: 0
-	Content-Type: text/plain; charset=utf-8
+	Date: Wed, 18 Mar 2020 15:51:48 GMT
+	Content-Length: 160
+
+	{
+		"alerts": [
+			{
+				"text": "This endpoint is deprecated, please use PUT /snapshots with either the query parameter cdn or cdnID instead",
+				"level": "warning"
+			}
+		],
+		"response": "SUCCESS"
+	}
\ No newline at end of file
diff --git a/docs/source/api/v2/cdns_id_snapshot.rst b/docs/source/api/v2/cdns_id_snapshot.rst
deleted file mode 100644
index 729cddf..0000000
--- a/docs/source/api/v2/cdns_id_snapshot.rst
+++ /dev/null
@@ -1,66 +0,0 @@
-..
-..
-.. Licensed under the Apache License, Version 2.0 (the "License");
-.. you may not use this file except in compliance with the License.
-.. You may obtain a copy of the License at
-..
-..     http://www.apache.org/licenses/LICENSE-2.0
-..
-.. Unless required by applicable law or agreed to in writing, software
-.. distributed under the License is distributed on an "AS IS" BASIS,
-.. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-.. See the License for the specific language governing permissions and
-.. limitations under the License.
-..
-
-.. _to-api-cdns-id-snapshot:
-
-************************
-``cdns/{{ID}}/snapshot``
-************************
-
-``PUT``
-=======
-Performs a CDN :term:`Snapshot`. Effectively, this propagates the new *configuration* of the CDN to its *operating state*, which replaces the output of the :ref:`to-api-cdns-name-snapshot` endpoint with the output of the :ref:`to-api-cdns-name-snapshot-new` endpoint.
-
-.. Note:: Snapshotting the CDN also deletes all HTTPS certificates for every :term:`Delivery Service` which has been deleted since the last CDN :term:`Snapshot`.
-
-:Auth. Required: Yes
-:Roles Required: "admin" or "operations"
-:Response Type:  ``undefined``
-
-Request Structure
------------------
-.. table:: Request Path Parameters
-
-	+------+----------------------------------------------------------------------------------------+
-	| Name | Description                                                                            |
-	+======+========================================================================================+
-	|  ID  | The integral, unique identifier of the CDN for which a :term:`Snapshot` shall be taken |
-	+------+----------------------------------------------------------------------------------------+
-
-.. code-block:: http
-	:caption: Request Example
-
-	PUT /api/2.0/cdns/2/snapshot HTTP/1.1
-	Host: trafficops.infra.ciab.test
-	User-Agent: curl/7.47.0
-	Accept: */*
-	Cookie: mojolicious=...
-
-Response Structure
-------------------
-.. code-block:: http
-	:caption: Response Example
-
-	HTTP/1.1 200 OK
-	Access-Control-Allow-Credentials: true
-	Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
-	Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
-	Access-Control-Allow-Origin: *
-	Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 GMT; Max-Age=3600; HttpOnly
-	Whole-Content-Sha512: z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==
-	X-Server-Name: traffic_ops_golang/
-	Date: Wed, 12 Dec 2018 22:04:46 GMT
-	Content-Length: 0
-	Content-Type: text/plain; charset=utf-8
diff --git a/docs/source/api/v2/snapshot_name.rst b/docs/source/api/v2/snapshot.rst
similarity index 63%
rename from docs/source/api/v2/snapshot_name.rst
rename to docs/source/api/v2/snapshot.rst
index 65ec155..f2b2cc4 100644
--- a/docs/source/api/v2/snapshot_name.rst
+++ b/docs/source/api/v2/snapshot.rst
@@ -13,11 +13,11 @@
 .. limitations under the License.
 ..
 
-.. _to-api-snapshot-name:
+.. _to-api-snapshot:
 
-*********************
-``snapshot/{{name}}``
-*********************
+************
+``snapshot``
+************
 
 ``PUT``
 =======
@@ -31,18 +31,22 @@ Performs a CDN :term:`Snapshot`. Effectively, this propagates the new *configura
 
 Request Structure
 -----------------
-.. table:: Request Path Parameters
+.. table:: Request Query Parameters
 
-	+------+-----------------------------------------------------------------+
-	| Name | Description                                                     |
-	+======+=================================================================+
-	| name | The name of the CDN for which a :term:`Snapshot` shall be taken |
-	+------+-----------------------------------------------------------------+
+	+-------+-----------------------------------------------------------------+
+	| Name  | Description                                                     |
+	+=======+=================================================================+
+	| cdn   | The name of the CDN for which a :term:`Snapshot` shall be taken |
+	+-------+-----------------------------------------------------------------+
+	| cdnID | The id of the CDN for which a :term:`Snapshot` shall be taken   |
+	+-------+-----------------------------------------------------------------+
+
+.. Note:: At least one query parameter must be given.
 
 .. code-block:: http
 	:caption: Request Example
 
-	PUT /api/2.0/snapshot/CDN-in-a-Box HTTP/1.1
+	PUT /api/2.0/snapshot?cdn=CDN-in-a-Box HTTP/1.1
 	Host: trafficops.infra.ciab.test
 	User-Agent: curl/7.47.0
 	Accept: */*
@@ -58,9 +62,14 @@ Response Structure
 	Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
 	Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
 	Access-Control-Allow-Origin: *
+	Content-Encoding: gzip
+	Content-Type: application/json
 	Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 GMT; Max-Age=3600; HttpOnly
-	Whole-Content-Sha512: z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==
+	Whole-Content-Sha512: gmaWI0tKgNFPYO0zMrLCGDosBJkPbeIvW4BH9tEh96VjBqyWqzjgPySoMa3ViM1BQXA6VAUOGmc76VyhBsaTzA==
 	X-Server-Name: traffic_ops_golang/
-	Date: Wed, 12 Dec 2018 22:00:18 GMT
-	Content-Length: 0
-	Content-Type: text/plain; charset=utf-8
+	Date: Wed, 18 Mar 2020 15:51:48 GMT
+	Content-Length: 47
+
+	{
+		"response": "SUCCESS"
+	}
\ No newline at end of file
diff --git a/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh b/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
index b28dafc..bb8e6ca 100755
--- a/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
+++ b/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
@@ -349,7 +349,7 @@ to-auto-snapqueue() {
 			sleep $AUTO_SNAPQUEUE_ACTION_WAIT
 			echo "AUTO-SNAPQUEUE - Do automatic snapshot..."
 			cdn_id=$(to-get "api/$TO_API_VERSION/cdns?name=$2" |jq '.response[0].id')
-			to-put "api/$TO_API_VERSION/cdns/$cdn_id/snapshot"
+			to-put "api/$TO_API_VERSION/snapshot?cdnID=$cdn_id"
 			sleep $AUTO_SNAPQUEUE_ACTION_WAIT
 			echo "AUTO-SNAPQUEUE - Do queue updates..."
 			to-post "api/$TO_API_VERSION/cdns/$cdn_id/queue_update" '{"action":"queue"}'
diff --git a/traffic_control/clients/python/trafficops/tosession.py b/traffic_control/clients/python/trafficops/tosession.py
index 9630fb4..5468124 100644
--- a/traffic_control/clients/python/trafficops/tosession.py
+++ b/traffic_control/clients/python/trafficops/tosession.py
@@ -1982,13 +1982,13 @@ class TOSession(RestApiSession):
 		:raises: Union[LoginError, OperationError]
 		"""
 
-	@api_request('put', 'snapshot/{cdn_name}', ('2.0',))
-	def snapshot_crconfig(self, cdn_name=None):
+	@api_request('put', 'snapshot', ('2.0',))
+	def snapshot_crconfig(self, query_params=None):
 		"""
-		Snapshot CRConfig by CDN Name.
-		:ref:`to-api-snapshot-name`
-		:param cdn_name: The CDN name
-		:type cdn_name: str
+		Snapshot CRConfig by CDN Name or ID.
+		:ref:`to-api-snapshot`
+		:param query_params: The optional url query parameters for the call
+		:type query_params: Dict[str, Any]
 		:rtype: Tuple[Dict[str, Any], requests.Response]
 		:raises: Union[LoginError, OperationError]
 		"""
diff --git a/traffic_ops/traffic_ops_golang/crconfig/handler.go b/traffic_ops/traffic_ops_golang/crconfig/handler.go
index 555d48f..eba20dc 100644
--- a/traffic_ops/traffic_ops_golang/crconfig/handler.go
+++ b/traffic_ops/traffic_ops_golang/crconfig/handler.go
@@ -123,33 +123,54 @@ func SnapshotOldGetHandler(w http.ResponseWriter, r *http.Request) {
 
 // SnapshotHandler creates the CRConfig JSON and writes it to the snapshot table in the database.
 func SnapshotHandler(w http.ResponseWriter, r *http.Request) {
-	inf, userErr, sysErr, errCode := api.NewInfo(r, nil, []string{"id"})
+	snapshotHandler(w, r, false)
+}
+
+// SnapshotHandlerDeprecated creates the CRConfig JSON and writes it to the snapshot table in the database for deprecated routes.
+func SnapshotHandlerDeprecated(w http.ResponseWriter, r *http.Request) {
+	snapshotHandler(w, r, true)
+}
+
+// SnapshotHandler creates the CRConfig JSON and writes it to the snapshot table in the database.
+func snapshotHandler(w http.ResponseWriter, r *http.Request, deprecated bool) {
+	alt := "PUT /snapshots with either the query parameter cdn or cdnID"
+	inf, userErr, sysErr, errCode := api.NewInfo(r, nil, []string{"id", "cdnID"})
 	if userErr != nil || sysErr != nil {
-		api.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr)
+		api.HandleErrOptionalDeprecation(w, r, inf.Tx.Tx, errCode, userErr, sysErr, deprecated, &alt)
 		return
 	}
 	defer inf.Close()
 
 	db, err := api.GetDB(r.Context())
 	if err != nil {
-		api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New("SnapshotHandler getting db from context: "+err.Error()))
+		api.HandleErrOptionalDeprecation(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New("SnapshotHandler getting db from context: "+err.Error()), deprecated, &alt)
 		return
 	}
 
 	cdn, ok := inf.Params["cdn"]
 	if !ok {
-		id, ok := inf.IntParams["id"]
-		if !ok {
-			api.HandleErr(w, r, inf.Tx.Tx, http.StatusNotFound, errors.New("params missing CDN"), nil)
-			return
+		var id int
+		if deprecated {
+			id, ok = inf.IntParams["id"]
+			if !ok {
+				api.HandleErrOptionalDeprecation(w, r, inf.Tx.Tx, http.StatusNotFound, errors.New("params missing CDN"), nil, deprecated, &alt)
+				return
+			}
+		} else {
+			id, ok = inf.IntParams["cdnID"]
+			if !ok {
+				api.HandleErrOptionalDeprecation(w, r, inf.Tx.Tx, http.StatusBadRequest, errors.New("CDN must be identified via the query parameter cdn or cdnID"), nil, deprecated, &alt)
+				return
+			}
 		}
+
 		name, ok, err := getCDNNameFromID(id, inf.Tx.Tx)
 		if err != nil {
-			api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New("Error getting CDN name from ID: "+err.Error()))
+			api.HandleErrOptionalDeprecation(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New("Error getting CDN name from ID: "+err.Error()), deprecated, &alt)
 			return
 		}
 		if !ok {
-			api.HandleErr(w, r, inf.Tx.Tx, http.StatusNotFound, errors.New("No CDN found with that ID"), nil)
+			api.HandleErrOptionalDeprecation(w, r, inf.Tx.Tx, http.StatusNotFound, errors.New("No CDN found with that ID"), nil, deprecated, &alt)
 			return
 		}
 		cdn = name
@@ -157,27 +178,31 @@ func SnapshotHandler(w http.ResponseWriter, r *http.Request) {
 
 	crConfig, err := Make(inf.Tx.Tx, cdn, inf.User.UserName, r.Host, r.URL.Path, inf.Config.Version, inf.Config.CRConfigUseRequestHost, inf.Config.CRConfigEmulateOldPath)
 	if err != nil {
-		api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, err)
+		api.HandleErrOptionalDeprecation(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, err, deprecated, &alt)
 		return
 	}
 
 	monitoringJSON, err := monitoring.GetMonitoringJSON(inf.Tx.Tx, cdn)
 	if err != nil {
-		api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New(r.RemoteAddr+" getting monitoring.json data: "+err.Error()))
+		api.HandleErrOptionalDeprecation(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New(r.RemoteAddr+" getting monitoring.json data: "+err.Error()), deprecated, &alt)
 		return
 	}
 
 	if err := Snapshot(inf.Tx.Tx, crConfig, monitoringJSON); err != nil {
-		api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New(r.RemoteAddr+" snaphsotting CRConfig and Monitoring: "+err.Error()))
+		api.HandleErrOptionalDeprecation(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New(r.RemoteAddr+" snaphsotting CRConfig and Monitoring: "+err.Error()), deprecated, &alt)
 		return
 	}
 
 	if err := deliveryservice.DeleteOldCerts(db.DB, inf.Tx.Tx, inf.Config, tc.CDNName(cdn)); err != nil {
-		api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New(r.RemoteAddr+" snapshotting CRConfig and Monitoring: starting old certificate deletion job: "+err.Error()))
+		api.HandleErrOptionalDeprecation(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New(r.RemoteAddr+" snapshotting CRConfig and Monitoring: starting old certificate deletion job: "+err.Error()), deprecated, &alt)
 		return
 	}
 
 	api.CreateChangeLogRawTx(api.ApiChange, "CDN: "+cdn+", ID: "+strconv.Itoa(inf.IntParams["id"])+", ACTION: Snapshot of CRConfig and Monitor", inf.User, inf.Tx.Tx)
+	if deprecated {
+		api.WriteAlertsObj(w, r, http.StatusOK, api.CreateDeprecationAlerts(&alt), "SUCCESS")
+		return
+	}
 	api.WriteResp(w, r, "SUCCESS")
 }
 
diff --git a/traffic_ops/traffic_ops_golang/routing/routes.go b/traffic_ops/traffic_ops_golang/routing/routes.go
index 1892fc8..146f469 100644
--- a/traffic_ops/traffic_ops_golang/routing/routes.go
+++ b/traffic_ops/traffic_ops_golang/routing/routes.go
@@ -432,8 +432,7 @@ func Routes(d ServerData) ([]Route, []RawRoute, http.Handler, error) {
 		//CRConfig
 		{api.Version{2, 0}, http.MethodGet, `cdns/{cdn}/snapshot/?$`, crconfig.SnapshotGetHandler, auth.PrivLevelReadOnly, Authenticated, nil, 2957273695, noPerlBypass},
 		{api.Version{2, 0}, http.MethodGet, `cdns/{cdn}/snapshot/new/?$`, crconfig.Handler, auth.PrivLevelReadOnly, Authenticated, nil, 276716889, noPerlBypass},
-		{api.Version{2, 0}, http.MethodPut, `cdns/{id}/snapshot/?$`, crconfig.SnapshotHandler, auth.PrivLevelOperations, Authenticated, nil, 254424150, noPerlBypass},
-		{api.Version{2, 0}, http.MethodPut, `snapshot/{cdn}/?$`, crconfig.SnapshotHandler, auth.PrivLevelOperations, Authenticated, nil, 2969911829, noPerlBypass},
+		{api.Version{2, 0}, http.MethodPut, `snapshot/?$`, crconfig.SnapshotHandler, auth.PrivLevelOperations, Authenticated, nil, 2969911829, noPerlBypass},
 
 		// Federations
 		{api.Version{2, 0}, http.MethodGet, `federations/all/?$`, federations.GetAll, auth.PrivLevelAdmin, Authenticated, nil, 21059986, noPerlBypass},
@@ -848,8 +847,8 @@ func Routes(d ServerData) ([]Route, []RawRoute, http.Handler, error) {
 		//CRConfig
 		{api.Version{1, 1}, http.MethodGet, `cdns/{cdn}/snapshot/?$`, crconfig.SnapshotGetHandler, auth.PrivLevelReadOnly, Authenticated, nil, 1957273695, noPerlBypass},
 		{api.Version{1, 1}, http.MethodGet, `cdns/{cdn}/snapshot/new/?$`, crconfig.Handler, auth.PrivLevelReadOnly, Authenticated, nil, 676716889, noPerlBypass},
-		{api.Version{1, 1}, http.MethodPut, `cdns/{id}/snapshot/?$`, crconfig.SnapshotHandler, auth.PrivLevelOperations, Authenticated, nil, 854424150, noPerlBypass},
-		{api.Version{1, 1}, http.MethodPut, `snapshot/{cdn}/?$`, crconfig.SnapshotHandler, auth.PrivLevelOperations, Authenticated, nil, 1969911829, noPerlBypass},
+		{api.Version{1, 1}, http.MethodPut, `cdns/{id}/snapshot/?$`, crconfig.SnapshotHandlerDeprecated, auth.PrivLevelOperations, Authenticated, nil, 854424150, noPerlBypass},
+		{api.Version{1, 1}, http.MethodPut, `snapshot/{cdn}/?$`, crconfig.SnapshotHandlerDeprecated, auth.PrivLevelOperations, Authenticated, nil, 1969911829, noPerlBypass},
 
 		// ATS config files
 		{api.Version{1, 1}, http.MethodGet, `servers/{server-name-or-id}/configfiles/ats/?(\.json)?$`, atsserver.GetConfigMetaData, auth.PrivLevelOperations, Authenticated, nil, 1755842214, perlBypass},
diff --git a/traffic_portal/app/src/common/api/CDNService.js b/traffic_portal/app/src/common/api/CDNService.js
index 4f5ecdb..1e8ef95 100644
--- a/traffic_portal/app/src/common/api/CDNService.js
+++ b/traffic_portal/app/src/common/api/CDNService.js
@@ -176,7 +176,7 @@ var CDNService = function($http, locationUtils, messageModel, ENV) {
     };
 
     this.snapshot = function(cdn) {
-        return $http.put(ENV.api['root'] + 'cdns/' + cdn.id + '/snapshot').then(
+        return $http.put(ENV.api['root'] + '/snapshot', {params: {cdnID: cdn.id}}).then(
             function(result) {
                 messageModel.setMessages([{level: 'success', text: 'Snapshot performed'}], true);
                 locationUtils.navigateToPath('/cdns/' + cdn.id);