We have an error when we try to update a campaign status using the API.
We get a message saying the we are trying to modify other fields than the status at the same time.
After checking our code, we only modify the status.
Does anyone has an explanation to this issue ?
Below the error we get :
"status":400,
"code":"invalid.update",
"message":"An attempt was made to update a Campaign in an invalid way. Details: A campaign cannot have other fields changed in the same update as a status change",
"messageWithParams":"An attempt was made to update a {entity} in an invalid way. Details: {INVALID_UPDATE}",
"messageParams":{"INVALID_UPDATE":"A campaign cannot have other fields changed in the same update as a status change","entity":"Campaign"},
"contextId":"f03592ec-e1a1-4fa5-be37-43675741886c",
"details":[],
"errors":[]
We don't use an specific endpoint as we use Java SDK from Purecloud: platform-client-v2-7.1.2.jar
The API used is OutboundApi and the method is putOutboundCampaign(String campaignId, Campaign campaign) where campaign is an object previously recovered from Purecloud with method getOutboundCampaign(String campaignId) (also from API OutboundApi).
We only change status of this object as here: campaign.setCampaignStatus("on")
Then putOutboundCampaign method returns us this error.
This error is probably being caused by you sending a campaign object that's populated with data. When you send a PUT request, it's going to look at everything in the body and use those values to make changes. Try creating a new Campaign object and only setting the status and send that as the body.
Hello Tim, I tried it but it doesn't work because if I set only the status, the error is:
{"status":400,"code":"bad.request","message":"Name is required.","details":[],"errors":[]}
And if I add name value then, the error is:
{"status":400,"code":"invalid.update","message":"An attempt was made to update a Campaign in an invalid way. Details: A campaign cannot have other fields changed in the same update as a status change","messageWithParams":"An attempt was made to update a {entity} in an invalid way. Details: {INVALID_UPDATE}","messageParams":{"INVALID_UPDATE":"A campaign cannot have other fields changed in the same update as a status change","entity":"Campaign"},"contextId":"b6bf72e7-03b7-40e9-b552-53090f55e6cc","details":[],"errors":[]}
My apologies, my previous response was incorrect. This is a PUT, not a PATCH, and therefore requires the full request body. I have verified that this works correctly using the SDK with the following code. Be sure that you don't change anything other than the status or you'll get that error.
It didn't work either. Same error but with different context id:
{"status":400,"code":"invalid.update","message":"An attempt was made to update a Campaign in an invalid way. Details: A campaign cannot have other fields changed in the same update as a status change","messageWithParams":"An attempt was made to update a {entity} in an invalid way. Details: {INVALID_UPDATE}","messageParams":{"INVALID_UPDATE":"A campaign cannot have other fields changed in the same update as a status change","entity":"Campaign"},"contextId":"0511c9e4-a1ba-4834-8e35-6e20945bbc5c","details":[],"errors":[]}
Hi
We get this same issue on one project. We use C# API. I share this link with end user dev team (they provide solution them-self). We think that it occurs because we use Filters in campaign configuration.
To try and eliminate the SDK as the cause, can you try this using the Developer Tools API Explorer? Try getting the campaign object, copy the response body, paste it into the PUT request, and update only the status property.