That being said, I should make the query param mandatory such that it
returns 400 Bad Request "Missing Parameters" to let the client know of the
error.

I will make this improvement and commit soon.

Best,
Girish

On Mon, Sep 7, 2020 at 11:59 AM Girish Vasmatkar <
girish.vasmat...@hotwaxsystems.com> wrote:

> Hi Hans -
>
> Here's that works (if you don't want to manually url encode) -
>
> curl -G -X  GET https://localhost:8443/rest/services/findProductById 
> --data-urlencode
> 'inParams={"idToFind":"GZ-1001"}' -H "Accept: application/json" -H
> "Authorization: Bearer $token" --insecure
>
> Note '-G' parameter to CURL. It appends the encoded data to the URL. Also, 
> *--data-urlencode
> *should contain key value pairs.
>
> There has to have a query parameter named 'inParams' to call services
> exposed as GET.
> During it's implementation, I had given a thought whether to map each
> service IN attribute as query parameter to the REST call, but I chose this
> approach. A GET service with too many IN attributes would have resulted in
> a large number of query parameters.
>
> Best,
> Girish
>
>
> On Mon, Sep 7, 2020 at 9:59 AM Hans Bakker <h.bak...@antwebsystems.com>
> wrote:
>
>> OK, made some progress, have it now working from the flutter dart
>> environment however......
>>
>> this curl works even from flutter dart,
>> curl -X  GET
>> https://localhost:8443/rest/services/findProductByI?inParams=%7B%22idToFind%22:%22GZ-1001%22%7D
>> -H "Accept: application/json" -H "Authorization: Bearer $token" --insecure
>> however i do not want to url encode myself, so shouldn't this also work:
>>
>> curl -X  GET https://localhost:8443/rest/services/findProductById
>> --data-urlencode "{'inparams': {'idToFind':'GZ-1001'}}" -H "Accept:
>> application/json" -H "Authorization: Bearer $token" --insecure
>>
>> I tried it also without the inner quotes but could not get his to
>> work.....
>>
>> i get:
>> {
>>   "statusCode" : 500,
>>   "statusDescription" : "Internal Server Error"
>> }
>>
>> can you help?
>>
>> regards,
>>
>> Hans
>> On 9/5/20 8:26 PM, Girish Vasmatkar wrote:
>>
>> Hello Hans
>>
>> Thanks for giving it (REST Impl) a try and providing valuable feedback. The
>> token's signature part and the payload part (that includes claims) does
>> indeed change, while the header part is not expected to change.
>> The token is revoked after it is expired (default is 1800 seconds based on
>> security.properties).
>>
>> Looking forward to hearing more from you and please let us know of any
>> issue you encounter.
>>
>> Best Regards,
>> Girish
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sat, Sep 5, 2020 at 6:51 AM Hans Bakker <h.bak...@antwebsystems.com> 
>> <h.bak...@antwebsystems.com>
>> wrote:
>>
>>
>> Good day!
>>
>> Good to see we finally have a REST interface in OFBiz, thank you
>> girishvasmatkar for this implementation!
>>
>>   I will try to use it for the Growerp.org open source project, a
>> flutter frontend for currently Moqui.org but also will try to use OFBiz,
>> yes with this REST interface.
>>
>> My experience after away from ofbiz for a couple of years and just for
>> other users getting started email.
>>
>> OFBIZ install:
>> ==========
>> i looked how to install ofbiz in the readme.adoc fle , this tells me to
>> run ./gradle/init-gradle-wrapper for linux
>> did not worked on my linux system, however ./gradlew init-gradle-wrapper
>> worked but got stuck at the end...
>> killed it and then ran ./gradlew cleanAll loadAll and all was fine.
>>
>> Did not know how to install a plugin, ( a lot changed the last couple of
>> years that is good!) so i added it to the application folder and updated
>> the component-load.xml file. that was still the same.
>>
>> REST plugin:
>> ==========
>> then I searched for how to get an token after authorization.
>> These curl commands worked for me: could be added to the READ me file?
>>
>> curl -X POST https://localhost:8443/rest/auth/token -H "Accept:
>> application/json" -u admin:ofbiz --insecure
>>
>> however when i requested it the second time, the token did not change?
>> shouldn't it? Now i cannot revoke a token?
>>
>> then tried the services list:
>> curl -X GET https://localhost:8443/rest/services -H "Accept:
>> application/json" -H "Authorization: Bearer
>> eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJBcGFjaGVPRkJpeiIsImlhdCI6MTU0NzczOTM0OCwiZXhwIjoxNjc5Mjc1MzQ4LCJhdWQiOiJ3d3cuZXhhbXBsZS5jb20iLCJzdWIiOiJqcm9ja2V0QGV4YW1wbGUuY29tIiwiR2l2ZW5OYW1lIjoiSm9obm55IiwiU3VybmFtZSI6IlJvY2tldCIsIkVtYWlsIjoianJvY2tldEBleGFtcGxlLmNvbSIsInVzZXJMb2dpbklkIjoiYWRtaW4iLCJSb2xlIjpbIk1hbmFnZXIiLCJQcm9qZWN0IEFkbWluaXN0cmF0b3IiXX0.fwafgrgpodBJcXxNTQdZknKeWKb3sDOsQrcR2vcRw97FznD6mkE79p10Tu7cqpUx7LiXuROUAnXEgqDice-BSg"
>>
>> --insecure
>>
>> also working fine!
>>
>> if I have more comments or remarks, i will let you know
>>
>> Regards,
>>
>> Hans Bakker https://www.AntWebsystems.com
>> we specialize in flutter.dev growerp.org moqui.org and ofbiz.apache.org
>>
>>
>>

Reply via email to