“ statusCode”:404,“ message”:“找不到资源”

问题描述 投票:0回答:1

我尝试通过使用js节点来使用Face api,但响应始终为“ statusCode”:404,“ message”:“ Resource not found”,安装时我应该缺少一些东西?

这是我的代码

const uriBase2 = 'https://myendpoint/face/v1.0/persongroups';

const params = {
    'personGroupId': 'dava12345',
};

const options = {
    uri: uriBase2,
    qs: params,
    method: 'PUT',
    body: '{ "name": "group2", "userData": "user-provided data attached to ", "recognitionModel": "recognition_02" }',
    headers: {
        'Content-Type': 'application/json',
        'Ocp-Apim-Subscription-Key' : 'mykey'
    }
};


 request(options, (error, response, body) => {
     if (error) {
       console.log('Error: ', error);
       return;
     }
     let jsonResponse = JSON.stringify(JSON.parse(body), null, '  ');
     console.log('JSON Response\n');
     console.log(jsonResponse);
   });
node.js microsoft-cognitive face-recognition
1个回答
0
投票
const request = require('request');

const uriBase = 'https://ea***s.api.cognitive.microsoft.com/face/v1.0/persongroups';

const params = {
    'personGroupId': 'pan***test',
};

const options = {
    url: uriBase,
    method: 'GET',
    headers: {
        'Content-Type': 'application/json',
        'Ocp-Apim-Subscription-Key' : '6e4f6d73***23ddf2f5792'
    }
};

request(options, function(err, res, body) {
    let json = JSON.parse(body);
    console.log(json);
});

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.