Help with RestSharp and Flurl GET request
I dont understand the libraries of RestSharp and Flurl. I just need to do a simple get request that returns a string that then i convert into a json.
I already managed to make a succesful get request with a regular HttpClient so i know that the api works and its these libraries that i fail to understand
10 Replies
this is how i made it with the HttpClient and the get request worked now i just need to do the get request with RestSharp and Flurl
If HttpClient works... any reason you're using Flurl and RestSharp?
And Newtonsoft, for that matter?
its a school homework
to learn a little bit about other libraries i guess
Newtonsoft is just doing the json convert
Well then, first of all, you're not calling the same URL in RestSharp as you are with HttpClient
The parameter of
RestClientOptions()
is the base URL
So you're calling, essentially, https://rh-central.azurewebsites.net/index.html/api/RH/GetAllEmployees
What you probably want is https://rh-central.azurewebsites.net/api/RH/GetAllEmployees
insteadRefer to the docs, as always: https://restsharp.dev/docs/intro
Quick start | RestSharp
Introduction
i forgot this part. its just the setting up of the _httpclient that contains the link address

Maybe HttpClient strips that
index.html
away...?
If you look at the docs for this API, it's clear that the index.html
is not a part of the API path: https://rh-central.azurewebsites.net/index.html
lol yea it was the index.html
now it works on both functions
Nice