Reputation: 722
I can retrieve all contact list but how can i retrieve single contact list by contact ID? I'm using c# code. Please see my below code. I'm trying below way but its not working. I need to send request like this url.
GET https://api.xero.com/api.xro/2.0/Contacts/e8000dd0-3a27-4a2d-bc54-a451a1d14cea
I try to send request below way but its pulling all contact. I need to pull out an individual contact. How can achieve that? how can pass my parameter like request.AddQueryParameter("ContactID", "e8000dd0-3a27-4a2d-bc54-a451a1d14cea");
var request = new RestRequest(_apiMethod, Method.GET); // _apiMethod=contacts
request.AddHeader("Authorization", string.Format("Bearer {0}", filter.AuthToken));
request.AddHeader("Accept", "application/json");
request.AddHeader("Xero-tenant-id", filter.TenantId);
request.AddParameter("ContactID", "e8000dd0-3a27-4a2d-bc54-a451a1d14cea", ParameterType.UrlSegment);
request.AddQueryParameter("ContactID", "e8000dd0-3a27-4a2d-bc54-a451a1d14cea");
Thanks in Advance !
Kind Regards, Liton
Upvotes: 0
Views: 317
Reputation: 722
I have resolve this issue with below code sample
var client = new RestClient(BaseUrl);
var method = string.Format("/{0}/{1}", _apiMethod, "e8000dd0-3a27-4a2d-bc54-a451a1d14cea");
var request = new RestRequest(method, Method.GET);
I'm sending contactId below way
var method = string.Format("/{0}/{1}", _apiMethod, ContactId);
Thanks !
Upvotes: 1