-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating a campiagn's content #808
Comments
Hello @assafzaitlin, Thanks for submitting a GitHub issue! We are very sorry that you are running into this problem. In order to better serve you, as this does not present itself as a library specific issue, we would like to ask that you reach out to our support team at https://support.sendgrid.com. Thank you! SendGrid DX Team |
I'm experiencing the same issue. Just created my account and trying to write some test Python code for creating campaigns. I've tried a couple of snippets from USAGE.md and all of them return 403 status while examples from |
The campaign example contains integer List ID while I see UUID in web UI. It's unclear if the latter one is correct or how can I get all the ids in the example from Web UI or if it's at all possible. |
You need to edit API key access at https://app.sendgrid.com/settings/api_keys You definitely should add it to these examples. |
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:
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:
The text was updated successfully, but these errors were encountered: