Jump to content
X2Community Forums

[Solved] API search by field returning 404

Recommended Posts

Here's the setup:


I have a custom module: Portfolio

Portfolio has a custom field: c_buyer (Alias to Accounts records)

c_buyer is a Lookup field for Accounts

c_buyer stores the nameId of the account


When performing an api call: 

Portfolio/by:c_buyer=First Last_ID


There is a space, which is badly interpreted and returns a 404


%20 does not work

+ does not work


I have not been able to determine where/how to urldecode() the space

Link to post
Share on other sites

Encoding the space using %20 should work. Please double check to ensure there aren't any extra characters in the URI, and that and it ends in ".json". Also, custom attributes are prefixed with "c_" when stored internally, and hence must be prefixed in the same way when specifying criteria in the API. If you need to filter on multiple attributes, they must be separated by a semi colon character (;)


For example, a similar query to retrieve the Contacts whose company is Example Co. expects the URL to be formatted as follows:

curl -u admin:admin --header "Content-Type:application/json" http://localhost/index.php/api2/Contacts/by:company=Example%20Co._33.json
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...