Return results/redirect for method call 'set_entry'

C#/Python dev here, dusting off my PHP knowledge.

Writing a PHP form that will use the 4.1 REST API to create an entry in our SuiteCRM system using this documentation. The user fills out a simple form and if the data is valid, it uses the API to create an entry in the SuiteCRM system. It works great; however, the call function that I used from the API examples does not return any data. It’s just NULL. I did a ‘var_dump’ on the results. I get a redirect with a “Location” local to the SuiteCRM system. The following is the contents of the ‘$set_entry_result’ from the example.

string(486) "HTTP/1.1 302 Found
Date: Mon, 03 Nov 2014 16:02:23 GMT
Server: Apache
X-Powered-By: PHP/5.3.3
Set-Cookie: PHPSESSID=lunmgsjldhlcic40h1kiqh3fc7; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: index.php?module=Cases&action=DetailView&record=8dfe3d26-0819-5cda-7a02-5457a75a4167
Content-Length: 16
Connection: close
Content-Type: text/html; charset=UTF-8

did we redirect?"

Technically, the form works, but I need to get the ID added so I can give the user more information about the entry they just created after they create it. The only difference between the my code and the example is that I added:

curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, false);

because the code would not work otherwise. We’re using SuiteCRM internally and do not have a security certificate setup for it.

try setting the CURLOPT_FOLLOWLOCATION to true

Thanks for the reply, Matt. When I run it with this option set to true, it will actually try and follow the link. The link tries to redirect me to the Entry page in SuiteCRM (index.php?module=Cases&action=DetailView&record=8dfe3d26-0819-5cda-7a02-5457a75a4167 from above) but since that page does not exist on my server it gives me the IIS 404 error page. My PHP form lives on “Server A” and my SuiteCRM system lives on “Server B”. I feel like it’s not behaving like an API for some reason. Instead of returning a JSON object it’s trying to return me to a SuiteCRM DetailView.

what kind of record are you creating and do you have any customisations on your crm?

I went ahead and I copied the example again into a new file. The only thing I added was the CURL option I mentioned before and my credentials. The example creates an entry in “Accounts”. It worked and it gave me a return result. I changed the “module_name” to “Cases” which is what I am attempting to create with my script and it works but it returns NULL.

So, it looks like there’s something weird with my “Cases” module. Matt, I did not set this system up (my IT admin did). Do you have any recommendations for troubleshooting from this point?

I would check for any additional modules installed and check if there are any workflows running on Cases,

and check if anyone has made any modifications

you can also enable debug in admin system settings (bottom panel) and that will log mostly everything and may help your track down the issue

Matt, what type of customization would break the API? The administrator has made a few changes. I found a “cases_cstm” table that would indicate that some customizations were made.

When searching the Log file around where the Case was being created I found:

[ERROR] Unable to load custom logic file: modules/AOP_Case_Events/CaseEventssHook.php


[ERROR] Unable to load custom logic file: include/SugarSearchEngine/SugarSearchEngineQueueManager.php

I found a post here about the former, but no solution. Would this have anything to do with my problem?