How do I call and add multiple parameters from API to url in C# RRS feed

  • Question

  • User-353084080 posted

    I have multiple organizational URI's that need to be called into a URL. I have a button opening a new page with list of "agents" who are from different organizational units.

    Below I've called from unit 474 from the API.

    public async Task<List<Agent>> GetAgents()
    var result = await Helper.GetAsync<AgentSearchResult>($"{_propertyApiSettings.BaseUrl}beta/Staff?organisationalUnitUri=/OrganisationalUnit/474", config: await GetHeaders());
    return result.Result.Results;

    What do I need to add to include another organizational unit? For example 123.

    I've tried this:

    public async Task<List<Agent>> GetAgents()
            var result = await Helper.GetAsync<AgentSearchResult>($"{_propertyApiSettings.BaseUrl}beta/Staff?organisationalUnitUri=/OrganisationalUnit/474&organisationalUnitUri=/OrganisationalUnit/123", config: await GetHeaders());
            return result.Result.Results;
    Tuesday, July 7, 2020 11:24 PM

All replies

  • User475983607 posted

    Passing a parameter to a function/method is a standard concept in programming.

    public async Task<List<Agent>> GetAgents(string unit)
        var result = await Helper.GetAsync<AgentSearchResult>($"{_propertyApiSettings.BaseUrl}beta/Staff?organisationalUnitUri=/OrganisationalUnit/{unit}", config: await GetHeaders());
        return result.Result.Results;


    string unit = "474";
    var result = await GetAgents(unit);

    C# programming guide.


    Wednesday, July 8, 2020 12:13 AM
  • User303363814 posted

    What is the beta/Staff uri?  Can it handle multiple parameters?  If so, what format does it expect?  That is the format you will need to provide them in.

    If it cannot handle multiple parameters then you will need to contact the owner to ask if they can expand the api.

    If you are the owner, then show us the implementation of the StaffController and someone will be able to advise you on a good method to handle multiple OrganisationalUnts.

    Wednesday, July 8, 2020 2:10 AM