Forum Xamarin.Forms

REST API

Could anyone help me?

I have my app connected to a REST API, but I can't seem to figure out how to get one item. I try to do this using the refit library.
So far I've got:

[Get("/Database/{num}/Likes")]
Task<int> GetLikes(int num);

Which is in an API.cs interface

And in my MainPage.xaml.cs, I've got:

var nsAPI = RestService.For<API>("[LINK TO MY API]");
currentLikes = await nsAPI.GetLikes(Convert.ToInt16(swipeCardView.Id));

When I run the app, I got the error "Specified cast is not valid."

Answers

Sign In or Register to comment.