I am sending a request from Nylas docs as mentioned in the examples. While creating the draft with form data its working fine ,but when I try it with updating the draft it is giving below error
{
“request_id”: “”,
“error”: {
“type”: “invalid_request_error”,
“message”: “NOT IMPLEMENTED”
}
}
i have tested with python, I am sending it as requests.
import requests
import json
Define your Nylas API credentials and endpoint
grant_id = “xxxxxx”
draft_id = “xxxxx”
url = f"/v3/grants/{grant_id}/drafts/{draft_id}"
Set the authorization token and headers
headers = {
“accept”: “application/json”,
“authorization”: “Bearer xxxxxxxxxxxxxx”,
“content-type”: “multipart/form-data”
}
Prepare the data for the draft update
data = {
“bcc”: [
{
“email”: “brandon.carson@exam”,
“name”: “”
}
],
“body”: “Hi, Welcome to Nylas!”,
“cc”: [
{
“email”: “clivescounters@exam”,
“name”: “”
}
],
“reply_to”: [
{
“email”: “healthcare.demo@example.com”,
“name”: “”
}
],
“starred”: False,
“thread_id”: “1910xxxxxxxxx”,
“subject”: “Invitation: Welcome! @ Thu Oct 28, 2021 7am - 8am (EDT) - Toronto”,
“to”: [
{
“email”: “demo”,
“name”: “”
},
{
“email”: “realestate.demo”,
“name”: “”
}
]
}
files = {
‘attachment’: open(“mails_sample.html”, ‘rb’)
}
Make the PUT request to update the draft
response = requests.put(url, headers=headers, data=data, files=files)
Check the response
if response.status_code == 200:
print(“Draft updated successfully:”, response.json())
else:
print(“Error updating draft:”, response.status_code, response.json())