I appreciate your continued help, but note that I’m connecting via HTTP, not HTTPS. I have added code to disable SSL as you suggest but I get the same output.
Luckily, I’ve found the problem. I’m not sure why it seems that only I have this issue, but I added more logging in the SuiteCRM code and found that the JSON rest_data
payload is ending up encoded. I’ve tried sending it as plain text ({"field": "value"}
) and as URL-encoded ({&field&: &value&}
). In the end the value received in SugarRestJSON->serve()
is:
{"user_auth":{"user_name":"admin","password":"dd995564b1fa70241364c5926aa27997"},"application_name":"My SuiteCRM REST Client","name_value_list":[]}
PHP’s json_decode
does not decode these HTML entities, so the resulting JSON object ended up being empty.
I’ve worked around this by adding html_entity_decode()
around the code that pulls the rest_data
.
I’ve submitted a PR for this: decode HTML entities in REST/JSON service by JoshMcCullough · Pull Request #558 · salesagility/SuiteCRM-Core · GitHub