Agility Management API JS SDK for creating URL redirects in Agility CMS
- Source:
Methods
(static) deleteUrlRedirection(requestParams) → {Promise}
Deletes a URL Redirection
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
requestParams |
Object
|
The paramaters for the API request.
|
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
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
requestParams |
Object
|
The paramaters for the API request.
|
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
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
requestParams |
Object
|
The paramaters for the API request.
|
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
});