Recent searches


No recent searches

Getting 500 error when trying to create an article

Answered


Posted Mar 25, 2021

I'm trying to create an article. Here are the parameters I'm sending:

{'article': {'title': 'MID contactor malfunction', 'body': '<h2>Possible causes</h2><p>Could be one of the following:\n- Aux Cable severed\n- Aux Cable terminations are incorrect\n- Bad inverter comm card</p><h2>Recommended Actions</h2><p>Try the following:\n- Check for continuity on Aux cable terminations.\n- Check that the conductors are terminated correctly and in the right order on both ends of the cable.\n- Measure voltage on the Aux terminals of the inverter. If you cannot read any voltage, the inverter COMM card may be defective and the unit may need to be serviced.</p>', 'locale': 'en-us', 'permission_goroup_id': 3756171, 'user_segment_id': 360002017912, 'labels': ['32058', 'f72_external_contactor_malfunction_critical']}}

This is the response I get:

"500 Internal Server Error\nIf you are the administrator of this website, then please read this web application's log file and/or the web server's log file to find out what went wrong."

And here's the python code I wrote to send this request:

defcreate_article(article):
section_id = '360012554811'

headers = {
'Content-Type': "application/json",
'Authorization': "[REDACTED BY ZENDESK]",
'cache-control': "no-cache",
'Postman-Token': "[REDACTED BY ZENDESK]"
}

payload = {
"article":{
"title":article["title"],
"body":article["text"],
"locale":"en-us",
"permission_goroup_id":3756171,
"user_segment_id":360002017912,
"labels": [article["event_code"],article["event_name"]]
},
}
print(payload)
response = requests.request("POST", url, headers=headers, verify=False, params=payload)
return response
 

0

5

5 comments

image avatar

Greg Katechis

Zendesk Developer Advocacy

Hi Alberto! Just to start, I removed the tokens from your post, because those could potentially be used to impersonate you on your instance. In the future, just make sure that you remove any sensitive information like that.

With respect to your error, I'm not sure where that error response is coming from, because that is not a Zendesk error at all. Have you been able to resolve this or are you still running into problems?

0


Thanks Greg!

Unfortunately I have not been able to make progress. The 500 error is an internal server error, isn't it? Wouldn't it be on the Zendesk side?

0


image avatar

Greg Katechis

Zendesk Developer Advocacy

Hi Alberto...I took another look at your payload and it looks like there is a misspelling in the attribute for permissions_group. Could you remove the extra "o" and then try this again?

Greg Katechis | Developer Support and Enablement Engineer

0


Hi Greg, I fixed the typo, but still no dice..

{'article': {'title': 'MID contactor malfunction', 'body': '<h2>Possible causes</h2><p>Could be one of the following:\n- Aux Cable severed\n- Aux Cable terminations are incorrect\n- Bad inverter comm card</p><h2>Recommended Actions</h2><p>Try the following:\n- Check for continuity on Aux cable terminations.\n- Check that the conductors are terminated correctly and in the right order on both ends of the cable.\n- Measure voltage on the Aux terminals of the inverter. If you cannot read any voltage, the inverter COMM card may be defective and the unit may need to be serviced.</p>', 'locale': 'en-us', 'permission_group_id': 3756171, 'user_segment_id': 360002017912, 'labels': ['32058', 'f72_external_contactor_malfunction_critical']}}

Still getting the same 500 error.

>>> response.text
"500 Internal Server Error\nIf you are the administrator of this website, then please read this web application's log file and/or the web server's log file to find out what went wrong."

0


image avatar

Greg Katechis

Zendesk Developer Advocacy

Hi again! I've taken your payload directly from here and successfully created an article in my own account with it. When I've checked your requests, the parameters that we are receiving are not the same as what I received, so there must be something in your script that is causing this issue. To confirm that, could you attempt to create the article manually without the script, either in postman or cURL?

Greg Katechis | Developer Support and Enablement Engineer

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post