I am getting this error from the API.
{
"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": "365afbfc-1888-4515-95e2-702f94f3c4b8",
"details": [],
"errors": []
}
This is what I get when I don't include any field other than "campaignStatus" in the request.
{
"status": 400,
"code": "bad.request",
"message": "Name is required.",
"details": [],
"errors": []
}
Could the issue be that in your original request you sent "name", but the error reports that "Name" is required? (I checked, this is not the right answer)
Looking at how the UI does this, it actually does a get on the campaign, changes the campaign status to on, and does a put of the whole thing. The UI also added a dateModified field.
Ah, my bad. It's a PUT, not a PATCH. PUT requests replace the existing object with whatever you send. @Jason_Mathison is correct. Send all the fields. By not sending all of the fields, it's trying to set all the fields you didn't send to null, so you get an error about changing fields other than status.
Sent in all the required fields along with the status. But still getting this error.
{
"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": "f1d4f313-7add-4bbb-a6c4-a9f388770f1c",
"details": [],
"errors": []
}
Request : The values for all the fields were the same as the values that the campaign already has. Except for the campaignStatus which was sent as "on".
{
"name": "",
"contactList": {
"id": "",
"name": "",
"selfUri": ""
},
"dialingMode": "",
"campaignStatus": "",
"callerName": "",
"callerAddress": ""
}
ok. Got it this time.
Did a getCampaign. then took the response of this API and used it as a request to the update campaign by changing the campaignStatus. Was able to change the status this way.