api - Moqui: How to add an extra Header in JSON Request? -
i trying build moqui service pull , push data remote rest json api require authenticate using custom header e.g. x-app-access-token: {access_token}
, can't seem find way add header when calling api service?
<service verb="get" noun="orders" type="remote-json-rpc" location="https://example.com/admin/orders.json"> <in-parameters> <parameter name="marketplaceid"/> <parameter name="accesstoken"/> </in-parameters> <actions> <service-call name="create#mantle.order.orderheader" in-map="context" out-map="context"/> </actions> </service>
thanks help!
sam
first notes: way have service setup wall call remote json rpc service , best have separate service call service , local service create order. more complex data structures order best call 1 of services (like orderservices.create#order creates orderheader , 1 orderpart) instead of simple crud implicitly defined auto entity service.
a local service setup placeholder remote json-rpc service handled remotejsonrpcservicerunner.runjsonservice() method. method static , can call directly too. calls stupidwebutilities.simplehttpstringrequest() method httpclient stuff is, , need add custom header.
in current code there no way this. 2 methods mentioned above extended support additional headers map, might not bad idea may useful in other scenarios. write own method or service script snippet do, simple code.
Comments
Post a Comment