danielcrenna/hammock — Issue #50: Multiple parameters with same name missing no the request
Author: nvanesch
Created: 2011-11-01 13:25:15+00:00
State: open

When attempting to access the LinkedIn people search api with Hammock

var client = new RestClient()
{
Authority = "http://api.linkedin.com/v1",
Credentials = new OAuthCredentials
{
Type = OAuthType.AccessToken,
SignatureMethod = OAuthSignatureMethod.HmacSha1,
ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
ConsumerKey = ConsumerKey,
ConsumerSecret = ConsumerKeySecret,
Token = Token ,
TokenSecret = TokenSecret ,
Verifier = Verifier
},
Method = Hammock.Web.WebMethod.Get
};

var request = new RestRequest { Path = "/people-search" };

request.AddParameter("keywords", "Project Manager");
request.AddParameter("country-code", "gb");
request.AddParameter("postal-code", "CB4 1AB");
request.AddParameter("distance", "50");
request.AddParameter("facet", "industry,112,43,84");
request.AddParameter("facet", "function,8,12,21"); // problematic parameter
request.AddParameter("sort", "distance");
request.AddParameter("facets", "industry,function");
request.AddParameter("count", "10");
request.AddParameter("start", "0");

RestResponse restResponse = client.Request(request);

If the second facet is removed the request returns successfully.

request.AddParameter("facet", "function,8,12,21");

If it is left in LinkedIn responds with unauthorised and the parameter is missing on the request url (see below). Not sure if it is being included in the OAuth calculation at this point (hence the unauthorised) but not in the final URL generation.

http://api.linkedin.com/v1/people-search?keywords=Project%20Manager&country-code=gb&postal-code=CB4%201AB&distance=50&facet=industry%2C112%2C43%2C84&sort=distance&facets=industry%2Cfunction&count=10&start=0