mardi 4 août 2015

how to add multiple http get methods with id as param?

I am writing web API, and have to add two get method with id as parameter.

1st api method :

[Route("{id}")]
    public IHttpActionResult GetItem(int id) {
        // some code
    }

2nd api method :

[Route("clientid/{id}")]
    public IHttpActionResult GetItemByClientID(int id) {
        // some code 
    }

ajax call :

$http({
       url: 'api/mycontroller/clientid',
       method: 'get',
       params: { id: id }
})

but its call 1st api method, so how can I call my second api method ?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire