Biblioteka queriesZastąp starą domenę nową domeną we wszystkich postach
Zastąp starą domenę nową domeną we wszystkich postach
To query najpierw filtruje wszystkie posty zawierające "https://my-old-domain.com" w ich treści, a następnie zastępuje ten ciąg znaków przez "https://my-new-domain.com".
To query wymaga, aby endpoint miał włączone Zagnieżdżone Mutacje.
mutation ReplaceOldWithNewDomainInPosts(
$oldDomain: String!,
$newDomain: String!
) {
posts(
filter: {
search: $oldDomain
},
pagination: {
limit: -1
}
) {
id
rawContent
adaptedRawContent: _strReplace(
search: $oldDomain
replaceWith: $newDomain
in: $__rawContent
)
update(input: {
contentAs: { html: $__adaptedRawContent }
}) {
status
errors {
__typename
...on ErrorPayload {
message
}
}
post {
id
rawContent
}
}
}
}