[Apiman-user] Mapping between REST services (GET/POST/PT/DELETE) & API Gateway

Charles Moulliard cmoulliard at redhat.com
Thu Jul 9 02:56:49 EDT 2015


I have been able to find how to use the APIMan Gateway

curl -k -H "Authorization: Bearer $TOKEN" 
https://127.0.0.1:8443/apiman-gateway/Newcastle/CustomerService/2.0/123

echo ">>> POST Customer : 124"

curl -k -H "Authorization: Bearer $TOKEN" -H "Content-Type: 
application/json" -X POST -d '{"Customer":{"name":"Charles"}}' 
https://127.0.0.1:8443/apiman-gateway/Newcastle/CustomerService/2.0

echo ">>> GET Customer : 124"

curl -k -H "Authorization: Bearer $TOKEN" 
https://127.0.0.1:8443/apiman-gateway/Newcastle/CustomerService/2.0/124

echo ">>> PUT Customer : 124"

curl -k -H "Content-Type: application/json" -X PUT -d 
'{"Customer":{"id":124,"name":"SMALS"}}' -H "Authorization: Bearer 
$TOKEN" https://127.0.0.1:8443/apiman-gateway/Newcastle/CustomerService/2.0/

echo ">>> DEL Customer : 124"

curl -v -k -X DEL -H "Authorization: Bearer $TOKEN" 
https://127.0.0.1:8443/apiman-gateway/Newcastle/CustomerService/2.0/124

echo ">>> GET Customer : 124"

curl -k -H "Authorization: Bearer $TOKEN" 
https://127.0.0.1:8443/apiman-gateway/Newcastle/CustomerService/2.0/124

But the DEL HTTP operation is not supported : 
https://github.com/apiman/apiman/issues/152

On 08/07/15 19:44, Charles Moulliard wrote:
> Hi,
>
> The API Manager allows to map the proxy service (= service to be 
> authorized) with the real service exposed by example by a REST Endpoint
>
> If the REST service exposes GET, PUT, DELETE & POST methods that we ca 
> nreach using these curl requests :
>
> 1) GET
>     curl http://localhost:8080/cxf/rest/customerservice/customers/123
> 2) POST
>     curl -i -H "Content-Type: application/json" -X POST -d 
> '{"Customer":{"name":"Charles"}}' 
> http://localhost:8080/cxf/rest/customerservice/customers
> 3) PUT
>     curl -i -H "Content-Type: application/json" -X PUT -d 
> '{"Customer":{"id":124,"name":"TUG"}}' 
> http://localhost:8080/cxf/rest/customerservice/customers
> 4) Delete
>      curl -X DEL 
> http://localhost:8080/cxf/rest/customerservice/customers/124
>
> I have encoded this service API : 
> http://localhost:9090/rest/customerservice/customers/ but when I try 
> to reach it using the proxy API ("curl -v -k -H "Authorization: Bearer 
> $TOKEN" 
> https://127.0.0.1:8443/apiman-gateway/Newcastle/CustomerService/"), I 
> get this response : Server returned HTTP response code: 405 for URL: 
> http://localhost:9090/rest/customerservice/customers
>
> QUESTION : Do I have to encode each service individually or can I 
> encode them one time when I declare the API Endpoint of the "Service 
> Implementation" ?
>
>
> Regards,
> -- 
> Charles Moulliard
> Principal Solution Architect / JBoss Fuse Expert - Global Enablement 
> @redhat
> cmoulliard at redhat.com | work: +31 205 65 12 84 | mobile: +32 473 604 014
> MC-Square Business "Stockholm", Leonardo Da Vincilaan 19, Diegem 1831 
> - Belgium
> twitter: @cmoulliard <http://twitter.com/cmoulliard> | blog: 
> cmoulliard.github.io <http://cmoulliard.github.io>
> committer: apache camel, karaf, servicemix, hawtio, fabric8, drools, 
> jbpm, deltaspike

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/apiman-user/attachments/20150709/81d07df1/attachment.html 


More information about the Apiman-user mailing list