Wix API difficulty in understanding setup and api calls

NOVATROOP77 256 Reputation points
2021-10-28T16:39:08.237+00:00

I am trying to figure out wix api. The documentation is rather good, but I am not used to how they require components on the client side. I am not to sure how that works.

Note: This is wix the web site builder, which my client uses for bookings and schedules. I am transferring that info to a xamian forms app by the way of api. Yes, I know I could have a web view of it, but the client wants it natively in the app.

Below is how I would make an api call normally through my c# app.

public async Task<ObservableCollection<WeightLifting>> GetAlLWeightLifting()
{
    ObservableCollection<WeightLifting> _result = new
    ObservableCollection<WeightLifting>();
    EnsureHttpClientCreated();
    var uri = new Uri(string.Format(Constants.BaseUrl + 
    Constants.ApiSegmant + Constants.GetAllWeightLiftings, string.Empty));

    // AddAuthenicationHeader();
    var response = await httpClient.GetAsync(uri);

    if (response.IsSuccessStatusCode)
    {
        var byteArray = await response.Content.ReadAsByteArrayAsync();

        var content = Encoding.UTF8.GetString(byteArray, 0, 
        byteArray.Length);
        _result = JsonConvert.DeserializeObject<ObservableCollection
           <WeightLifting>>(content);
    }
    return _result;
}

If I need to add authentication to the layer I use

public async void AddAuthenicationHeader()
{
    string bearerToken = db.GetTokenAsync();
    httpClient.DefaultRequestHeaders.Authorization = new 
    AuthenticationHeaderValue("Bearer", bearerToken);
}

I need to make three calls to wix: one to get all their booking information

Ideally I would like to get details of all the students, who are classed as participants in those sessions, but I dont see a call that would do that, the api uses oauth so am not to sure how to translate that into my code.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,209 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,312 questions
0 comments No comments
{count} votes