API V8 doesn't work with id's that are no UUID #8890
Labels
Area: API
Issues & PRs related to all things regarding the API
Priority:Moderate
Issues & PRs that are minor; broken styling, cosmetic, warnings - there are practical workarounds
Type:Suggestion
Issue containing a suggestion of functionality, process or UI. Associated PRs are called enhancement
Issue
I have created some records (Accounts and Contacts) that are imported from an external system and I've used the id's from the external system as the id in SuiteCRM as well. This is possible by setting the
'strict_id_validation' => false,
in the config.php file. However this doesn't work with the V8 API that has a hardcoded requirement on the format of the id, rejecting calls made to id's that are not in the UUID format.Expected Behavior
The Api V8 should accept all the id formats that are accepted by the UI and as such also use the value of the
strict_id_validation'
flag.Actual Behavior
The Api V8 uses its own hardcoded regular expression as specified in the file
Api/V8/Param/Options/Id.php
, which only allows UUID's.Possible Fix
Change the id.php to either (best case) use the exact same validation as the UI for id's or (not optimal case) use a different regular expression when the strict_id_validation flag is not set.
Steps to Reproduce
1.Set the
'strict_id_validation' => false,
in the config.php.2.Import (create) a Contact with an id that is not a UUID.
3.Try to get the Contact based on the id.
Context
I'm using the api to connect to other systems, however I have located the regular expression and corrected it to work for me, however this solution is not upgrade proof.
Your Environment
Version 7.11.13
Sugar Version 6.5.25 (Build 344)
The text was updated successfully, but these errors were encountered: