0

I am using project-oxford inorder to use Microsoft API with nodejs. I am keep on getting error that ,

{"code":"Unspecified","message":"Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key."}
{"code":"Unspecified","message":"Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key."}

I have also regenerated my subscription key for my microsoft account and tried to access the code. Still I am getting the same issue. Spent lot of time to find my bug fixed, But I couldn't able to solve.

This is my nodejs code,

var oxford = require('project-oxford'),
    client = new oxford.Client({SubscriptionKey});
client.video.trackFace({
            url: path,
        }).then(function (response) {
            console.log('Response ' + JSON.stringify(response));
        },function (error) {
            console.log("Error"+JSON.stringify(error));
        });

Please guide me to fix this issue.Thanks in Advance!!

Janani
  • 63
  • 2
  • 9

3 Answers3

1

You can obtain a key via the Microsoft Cognitive Services web site.

cthrash
  • 2,938
  • 2
  • 11
  • 10
  • Actually I fot subscription Id from the [site](https://www.microsoft.com/cognitive-services/en-US/subscriptions) . Though I get the same error. @cthrash – Janani Oct 18 '16 at 05:11
0

From what I can gather, you are using https://github.com/felixrieseberg/project-oxford, is that correct?

It seems that project requires one subscription key, which then is used for all API calls. I can't see any reasons it shouldn't work, if you have signed up for the subscription key for the Video API.

Given that the library you're using is built the way it is, it seems to me that you will only be able to use one API at the time, doing it the way you're doing it now.

Am I making any sense?

  • I have got the subscription key from the same site you have linked with , And is the same code i have mentioned above I am using it. But still I face the same error which I couldn't never fix. – Janani Oct 18 '16 at 11:20
  • Can you make sure the API key (a) is a string (meaning you didn't leave in the curly braces), and (b) is from the *video* subscription, and not the *face* subscription? – cthrash Oct 18 '16 at 14:28
  • Yes I am sure I got the subscription key for video subscription and not the face subscription. And as well i didnt leave the subscription key in curly braces something like `client = new oxford.Client('sdjfldsjflsdjflksjdflk');` @cthrash – Janani Oct 19 '16 at 07:13
0

Actually Now I am getting output for the same code excepting that I was not able use the localhost URL [i.e., http://localhost:3000/uploads/img.jpg]. While using the url of webserver only then I am getting the output!!

Can anyone explain me the complete fact. i.e., I need to know whether I cannot use the localhost url. If I use so I am getting the error which I have posted in this question.

Janani
  • 63
  • 2
  • 9
  • If you specify a URL, the service will attempt to download the file from that location. The service cannot resolve *your* localhost since the service is running in the cloud, not your machine. You have two options: (1) put the data file at a publicly-reachable URL, or (2) stream the data yourself. For the the video API you can say `path: your/path/to/uploads/img.jpg`. – cthrash Oct 20 '16 at 23:02
  • yes Thank You I have used publicly-reachable URL inorder to work with. But have a doubt which means you are saying not to use a video url for video API need to use image API i.e., cannot upload video right? @cthrash – Janani Oct 21 '16 at 04:53
  • I honestly cannot parse what you're asking. For the video API, you'll obviously want to upload a video, not an image. Similarly for the Computer Vision API, you'll want to upload an image, not a video. It is in your example that you specified a .jpg file, which is not typically a file extension used for video. – cthrash Oct 21 '16 at 05:07
  • Ya k **thank you** @cthrash I got some solution my stuff is just to recognise the image is there in video or not. by now I can verify two images is identical or not. I have decided to convert the video to frames and verify whether the image is available in those frames or not. But I need to take still more time to analyse the video API. – Janani Oct 21 '16 at 05:16