Skip to content

Updating a campiagn's content #808

@assafzaitlin

Description

@assafzaitlin

Issue Summary

Hi,
I'm trying to write a script that updates my marketing campaign's content. Even though I used an api key with full access, I keep getting "403 - Forbidden" response. I tried creating a new key and it still returned the same error code. Also, I know I'm using a valid key because my get and post requests are working, and only my patch request returns this error. I looked at its permissions and it has all marketing_campaigns permissions.

Edit:
I did some more tests and saw that it works if the campaign type is "code editor" and only when it's "design editor" the patch request returns 403 status code. My meaning by campaign type is:

campaign_types

Here is a sample of my code:

sg = sendgrid.SendGridAPIClient(api_key=API_KEY)
set_campaign_id(sg, CAMPAIGN_ID)

def set_campaign_id(sg, campaign_id):
camp = sg.client.campaigns._(campaign_id)
res = camp.get()
data = json.loads(res.body)
body = {}
body['html_content'] = data['html_content'].replace(str1, str2)
body['plain_content'] = data['plain_content'].replace(str1, str2)
body['subject'] = data['subject']
body['title'] = data['title']
body['categories'] = data['categories']
res = camp.patch(request_body=body)

Technical details:

  • sendgrid-python Version: 6.0.5
  • Python Version: 3.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: supportticket that should be redirected to support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions