This topic contains 2 replies, has 3 voices, and was last updated by igalayev 5 years, 10 months ago.
- Topic
Hello Guys,
I am trying to use built in OroCRM REST API, but it seems not to be working.
1.) For example, when trying to create new user I always get validation errors no matter what input data is provided. Please see example below.
12345678910111213141516171819202122232425262728293031323334353637383940414243POST /api/rest/latest/users.json{"phone": null,"title": null,"googleId": null,"username": "myusename","email": "myusename@test.com","namePrefix": null,"firstName": "test","middleName": null,"plainPassword" : "secretpassword""lastName": "user","nameSuffix": null,"birthday": null,"enabled": true,"lastLogin": "2018-05-17T06:56:54+00:00","createdAt": "2018-04-13T10:12:08+00:00","updatedAt": "2018-04-13T10:12:32+00:00","loginCount": 10,"passwordChangedAt": null,"groups": [],"owner": {"id": 1,"name": "Acme, General"},"emails": [],"businessUnits": [{"id": 1,"name": "Acme, General"}],"roles": [{"id": 3,"role": "ROLE_ADMINISTRATOR","label": "Administrator"}],"organization": "OroCRM","avatar": null}Response:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091{"code": 400,"message": "Validation Failed","errors": {"children": {"owner": {},"title": {},"custom_field": {},"username": {"errors": ["This value should not be blank."]},"email": {"errors": ["This value should not be blank."]},"phone": {},"namePrefix": {},"firstName": {"errors": ["This value should not be blank."]},"middleName": {},"lastName": {"errors": ["This value should not be blank."]},"nameSuffix": {},"birthday": {},"roles": {"children": {"2": {},"3": {},"4": {},"5": {},"6": {},"7": {}}},"groups": {"children": {"1": {},"2": {},"3": {},"4": {},"5": {},"6": {},"7": {},"8": {},"9": {}}},"organizations": {"children": {"organizations": {},"businessUnits": {}}},"emails": {},"avatar": {"children": {"file": {}}},"imapConfiguration": {"children": {"imapHost": {},"imapPort": {},"imapEncryption": {},"smtpHost": {},"smtpPort": {},"smtpEncryption": {},"user": {},"password": {},"folders": {}}},"passwordGenerate": {},"enabled": {},"plainPassword": {"errors": ["This value should not be blank."]}}}}Notice that same fields are marked as required when using HTTP FORM System/ User Management/ Users/ Create user
2.) I also tried to create new contact (via REST API) but there I got different error (no matter what input data I provide)
123456POST /api/rest/latest/contacts.json{"code": 500,"message": "Warning: array_key_exists() expects parameter 2 to be array, null given"}3.) I am using OroCRM 3.0.0 beta.
Can you tell me what I am missing? It’s working for GET methods, but not for POST commands.4.) I also noticed there is a lot of DEPRECATED methods labeled as “Deprecated since v1.8. Will be removed in v2.0.”.
Apparently that never happened. Any reason for that? Is REST API not maintained properly?Thank you and best regards
The forum ‘OroCRM’ is closed to new topics and replies.