Update a persisted request. See API authentication for more information about persisted requests.
The user must be authenticated and be the creator of the persisted request.
Request
The request object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
String |
Yes |
Identifier for the persisted request. |
|
|
String |
No |
Path to the method to execute when executing the persisted request. |
|
|
Object or Array of Object |
Yes |
Request object or array of objects sent as parameter when executing the persisted request. |
|
|
Object |
No |
Object with boolean parameters. Fields that have the boolean value |
|
|
String |
No |
Textual description of the persisted request. |
Response
The response object has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
String |
Identifier for the updated persisted request. |
Examples
$ cx.py /persisted/update '{"id":"58e5154490191e5ca6b941ee56f6e7349b9d2fe1","mutable":{"siteId":true}}'
{
"id": "58e5154490191e5ca6b941ee56f6e7349b9d2fe1"
}
$ curl "https://api.cxense.com/site?persisted=58e5154490191e5ca6b941ee56f6e7349b9d2fe1&json=%7B%22siteId%22%3A%229222300742735526873%22%7D"
{
"sites": [
{
"id": "9222300742735526873",
"name": "Example site",
"url": "https://www.example.com"
"country": "US",
"timeZone": "America/Los_Angeles",
}
]
}
$ cx.py /persisted/update '{"id":"58e5154490191e5ca6b941ee56f6e7349b9d2fe1","mutable":{"siteId":false}}'
{
"id": "58e5154490191e5ca6b941ee56f6e7349b9d2fe1"
}
$ curl "https://api.cxense.com/site?persisted=58e5154490191e5ca6b941ee56f6e7349b9d2fe1&json=%7B%22siteId%22%3A%229222300742735526873%22%7D"
{
"error": "Invalid request: Persisted request does not allow changes to field 'siteId'"
}
$ cx.py /persisted/create '{"path":"/profile/content/fetch","request":[{"url":"https://example.com"},{"url":"https://example.com/2"}],"mutable":{"url":true}}'
{
"id": "407e034dfc95554fe8bd8512315835d6dba7be46"
}
$ curl https://api.cxense.com/profile/content/fetch?persisted=407e034dfc95554fe8bd8512315835d6dba7be46
[
{
"url": "https://example.com",
"id": "0caaf24ab1a0c33440c06afe99df986365b0781f"
},
{
"url": "https://example.com/2",
"id": "a8e065093e3c0459cb6f9cf7b93e24b32258862a",
}
]
$ curl https://api.cxense.com/profile/content/fetch?persisted=407e034dfc95554fe8bd8512315835d6dba7be46 -d '[{"url":"https://example.com/3"},{"url":"https://example.com/4"}]'
[
{
"url": "https://example.com/3",
"id": "2ca558e8fd73221b1e45afaa1174d178061a9332",
},
{
"url": "https://example.com/4",
"id": "a510f1660d19b5f92d6023f2aaacd724d199bd15",
}
]
$ curl https://api.cxense.com/profile/content/fetch?persisted=407e034dfc95554fe8bd8512315835d6dba7be46 -d '{"url":"https://example.com/"}'
[
{
"url": "https://example.com",
"id": "0caaf24ab1a0c33440c06afe99df986365b0781f"
},
{
"url": "https://example.com",
"id": "0caaf24ab1a0c33440c06afe99df986365b0781f"
}
]