Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  Start Campaign via API

    Posted 11-01-2021 13:46
    No replies, thread closed.
    All - 

    I want to turn my campaign ON via api call and for that I am using below API request but getting error. I have tried multiple combinations but not getting through.

    Let me know if someone has any solution for this.

    API name -  /api/v2/outbound/campaigns/{campaignId}

    Request Body :
    {
    "name": "TestCampaign",
    "contactList": {
    "id": "80a6cba3-0fae-4389-8848-d5792b3c520a",
    "name": "TestCallingList"
    },
    "dialingMode": "power",
    "campaignStatus": "on",
    "phoneColumns": [
    {
    "columnName": "Phone",
    "type": "Cell"
    }
    ],
    "callerName": "xyz",
    "callerAddress": "+151xxxxxxx"
    }


    Getting below Error :

    {
    "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",
    "code": "invalid.update",
    "status": 400,
    "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": "1ea5c4da-af44-4601-bb93-1ddacc785875",
    "details": [],
    "errors": []
    }


    #Outbound

    ------------------------------
    Thanks,
    Anurag Gusain
    ------------------------------


  • 2.  RE: Start Campaign via API

    Posted 11-02-2021 12:39
    No replies, thread closed.
    Hi Anurag,

    The error tells you what you need to know -- some other field you provided in the update request has changed from the existing version of the campaign, and outbound campaigns can only have their `campaignStatus` changed if no other fields are changed at the same time. The request body for your campaign seems like it's missing some required fields, which may be the source of the issue. The endpoint is not a `PATCH`, and requires all fields to be provided even if they are not changed. 

    The best way to update a campaign (or most Outbound entities) via the API is to first issue a `GET` request to the same endpoint to get the current version, then update the fields you want to change on that response, and send it back as the body to the `PUT` request.

    Thanks,

    ------------------------------
    Sean Carter
    Lead Software Engineer - Outbound
    Genesys
    ------------------------------