UrlRedirections

AgilityManagement.Client. UrlRedirections

Agility Management API JS SDK for creating URL redirects in Agility CMS

Source:

Methods

(static) deleteUrlRedirection(requestParams) → {Promise}

Deletes a URL Redirection

Source:
Parameters:
Name Type Description
requestParams Object

The paramaters for the API request.

Name Type Description
urlRedirectionID Number

The id of the redirection to delete.

Returns:
Type:
Promise
  • No return value.
Example
import agilityMgmt from '@agility/content-management'

#Create a new instance API client
const api = agilityMgmt.getApi({
  location: 'MyLocation',
  websiteName: 'MyWebsiteName',
  securityKey: 'MySecurityKey'
});

api.deleteUrlRedirection({
 urlRedirectionID: urlRedirectionIDToDelete
})
.then(function() {
	 console.log("deleted");
})
.catch(function(error) {
 #handle error
});

(static) saveUrlRedirection(requestParams) → {Promise.<number>}

Saves a URL Redirection

Source:
Parameters:
Name Type Description
requestParams Object

The paramaters for the API request.

Name Type Attributes Description
originUrl String

The originUrl of the redirection.

destinationUrl String

The destinationUrl of the redirection.

httpStatusCode Number <optional>

The status code of the redirection (301 or 302) - defaults to 301

Returns:
Type:
Promise.<number>
  • Returns the urlRedirectionID.
Example
import agilityMgmt from '@agility/content-management'

#Create a new instance API client
const api = agilityMgmt.getApi({
  location: 'MyLocation',
  websiteName: 'MyWebsiteName',
  securityKey: 'MySecurityKey'
});

api.saveUrlRedirection({
 originUrl: "/from/link",
 destinationUrl: "/to/link"
})
.then(function(urlRedirectionID) {
	 console.log("saved ", urlRedirectionID);
})
.catch(function(error) {
 #handle error
});

(static) saveUrlRedirectionTest(requestParams) → {Promise}

Saves a URL Redirection Test

Source:
Parameters:
Name Type Description
requestParams Object

The paramaters for the API request.

Name Type Description
urlRedirectionID Number

The id of the redirection.

passed Boolean

Whether the test passed or not

testResult String

A string representing the test result in human readable form.

Returns:
Type:
Promise
  • No return value.
Example
import agilityMgmt from '@agility/content-management'

#Create a new instance API client
const api = agilityMgmt.getApi({
  location: 'MyLocation',
  websiteName: 'MyWebsiteName',
  securityKey: 'MySecurityKey'
});

api.saveUrlRedirectionTest({
 urlRedirectionID: urlRedirectionIDtoUpdate,
 passed: true,
 testResult: "- 301 to /dest-url"
})
.then(function() {
	 console.log("updated test");
})
.catch(function(error) {
 #handle error
});