Search code examples
restcurlsolrspacesdreamfactory

Dream factory call REST API and character parameter


Currently, I have a problem with Dream Factory REST API call, when a space is present into the API URL call. I have a get request with a sort parameter that must to be send for SOLR server. This space I don’t know how it is converted, but it seems to arrive into not appropriate mananer.

curl -X GET 
‘http://localhosts:81/api/v2/test/list/test?rows=10&sort=random_test%20desc’ 
-H ‘X-DreamFactory-Api-Key: e115f92d18ba58e9a29389’ 
-H ‘X-DreamFactory-Session-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1’

SOLR need to have this sort parameter and the direction of the sort. So we provide the column to sort, space and the direction. When I execute this curl using Dream Factory api, then the space or the %20 character seems to be converted into other thing.

Is there someone knowing, if this is a Dream factory problem, or whether it is possible to make the call in another manner?


Solution

  • Finaly the solution that I found is to change the curl call in order to make POST request and to put the parameters with spaces into the -d parameter.

    Here is the call working for our case :

     curl -X POST \
     'http://localhost:81/api/v2/test/list/test?rows=10' \
     -H 'X-DreamFactory-Api-Key: e115f92d18ba58e9a2' \
     -H 'X-DreamFactory-Session-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJz' \
     -d 'sort=random_test+DESC&fq=NAME:*ov*+OR+NAME:*a*'