When I run my .NET endpoint, I get an error message saying that the HTTP status that was returned was forbidden. The confusing part is when I type the full URL manually in my browsers (tried it on Edge and Chrome), I get the JSON that I wanted. That really confuses me because if the JSON is public, why do I get a forbidden status?
public async Task<List<NewServiceItemDto>> GetExistingListOfServices(string TargetUri)
{
IMapper mapper = GetMapperConfiguration().CreateMapper();
_ = new List<NewServiceItemDto>();
WordPressClient targetclient = new WordPressClient(TargetUri);
var randomSArgs = RandomString(6);
var listOfServices = await targetclient.CustomRequest.GetAsync<List<Service>>($"/wp-json/wp/v2/service?per_page=100&{randomSArgs}");
List<NewServiceItemDto> services = mapper.Map<List<NewServiceItemDto>>(listOfServices);
return services;
}