Trying to get Watson Visual Recognition working with C# but I am getting an unauthorised error when attempting to classify an image through the API. The credentials I'm using are the "Auto-generated service credentials".
The error that I am receiving is: ServiceResponseException: The API query failed with status code Unauthorized: Unauthorized
Here is my code:
class Program
{
static void Main(string[] args)
{
string apiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
string versionDate = "2018-03-19";
string endpoint = "https://gateway.watsonplatform.net/visual-recognition/api";
VisualRecognitionService visualRecognition = new VisualRecognitionService(apiKey, versionDate);
visualRecognition.SetEndpoint(endpoint);
// throws error here
var result = visualRecognition.Classify(url: "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Collage_of_Nine_Dogs.jpg/1023px-Collage_of_Nine_Dogs.jpg");
}
}
Also, let me know if I can provide anymore information that might help