How to manage basepath&endpoint variables

Not applicable

Hello,

I'd like to manage some variables included in the basepath and apply them into the target endpoint.

Taking as example this kind of API :

GET http://mydomain.com/v1/api/customers

GET http://mydomain.com/v1/api/customers/{id}

POST http://mydomain.com/v1/api/customers/{id}

GET http://mydomain.com/v1/api/customers/{id}/address

GET http://mydomain.com/v1/api/customers/{id}/address/{id}

GET http://mydomain.com/v1/api/customers/{id}/orders

GET http://mydomain.com/v1/api/customers/{id}/orders/{orderId}

Giving such results :

GET http://mydomain.com/v1/api/customers

-> http 206 (paginated responses, returning 10 first customers over many...)

-> {{"id":"001","name":"doe","firstname":"john"}, {"id":"002","name":"cho","firstname":"john"},

... , {"id":"010","name":"ten","firstname":"john"}}

GET http://mydomain.com/v1/api/customers/001

-> http 200

-> {"id":"001","name":"doe","firstname":"john","birthdate":"01/01/1954", etc...}

POST http://mydomain.com/v1/api/customers/{id}

-> http 200

-> customer created, blablabla

GET http://mydomain.com/v1/api/customers/001/address

-> http 200

-> {{"id":"adr1","city":"NY","zipcode":"xxx","country":"US"},

{"id":"adr2","city":"Los Angeles","zipcode":"xxx","country":"US"}}

PUT http://mydomain.com/v1/api/customers/001/address/adr1

-> http 200

-> adresse updated

etc...

I'm searching how can i add an API Proxies containing a regex, something like :

I guess there's some tips to fill the request target endpoint, but how to create the API proxies with such basepath?

Should i create only one base path /v1/api/customers then manage all the different calls in the same API Proxy?

0 2 1,339
2 REPLIES 2

Dear @alexandre.faria ,

Apigee API Proxy Basepath doesn't accept any special character like * or {} to specify variables. Idea behind the base path is to specify the resource or verb based on entity that you try to expose as an API.

Yes, You will create only one base path /v1/api/customers then manage all the different calls in the same API Proxy using policies , conditions, route rules.

Cheers,

Anil Sagar

Anil, is this still the case? According to this more recent post, wildcard is now allowed in BasePath. Can you verify?

https://apigee.cloud.answerhub.com/questions/17810/issue-in-proxybasepath-value-for-dynamic-proxy-ba...