Discussions

Ask a Question
Back to All

give me internal server error

create_stream : (user_id, request, callback) => {
// const options = {
// method: 'POST',
// url: 'https://api.d-id.com/talks/streams',
// headers: {
// accept: 'application/json',
// 'content-type': 'application/json',
// authorization: 'Basic Z2VraWpvNDE1OUBtdWdhZGdldC5jb20:Vv-jWFAlIkqK7CHVfZ_5N'
// },
// data: {
// face: { top_left: [0, 0], size: 512 },
// config: { motion_factor: 0, align_expand_factor: 0, stitch: true },
// source_url: 'https://clips-presenters.d-id.com/amy/FLZ1USJl7m/vzswgDCwKZ/image.png'
// }
// };

    // axios
    //   .request(options)
    //   .then(function (response) {
    //     console.log(response.data);
    //     callback('1', { keyword: 'rest_keywords_success', components: {} }, response.data);
    //   })
    //   .catch(function (error) {
    //     console.error(error);
    //     callback('0', { keyword: 'rest_keywords_something_went_wrong', components: {} }, error);
    //   });

    // const requestData = {
    //     face: { top_left: [0, 0], size: 512 },
    //     config: { motion_factor: 0, align_expand_factor: 0, stitch: true },
    //     source_url: 'https://clips-presenters.d-id.com/amy/FLZ1USJl7m/vzswgDCwKZ/image.png'
    //   };
    // const options = {
    //     method: 'POST',
    //     url: 'https://api.d-id.com/talks/streams',
    //     headers: {
    //         accept: 'application/json',
    //         'content-type': 'application/json',
    //         authorization: 'Basic Z2VraWpvNDE1OUBtdWdhZGdldC5jb20:Vv-jWFAlIkqK7CHVfZ_5N'
    //       },
    //     data: requestData
    //   };
      
    //   axios
    //     .request(options)
    //     .then(function (response) {
    //       console.log(response.data);
    //     })
    //     .catch(function (error) {
    //       console.error(error);
    //     });

    const requestData = {
                face: { top_left: [0, 0], size: 512 },
                config: { motion_factor: 0, align_expand_factor: 0, stitch: true },
                source_url: 'https://clips-presenters.d-id.com/amy/FLZ1USJl7m/vzswgDCwKZ/image.png'
            };
   
    const options = {
        method: 'POST',
        url: 'https://api.d-id.com/talks/streams',
        headers: {
          accept: 'application/json',
          'content-type': 'application/json',
          authorization: 'Basic Z2VraWpvNDE1OUBtdWdhZGdldC5jb20:Vv-jWFAlIkqK7CHVfZ_5N'
        },
        data:requestData
      };
      
      axios
        .request(options)
        .then(function (response) {
          console.log(response.data);
        })
        .catch(function (error) {
          console.error(error);
        });
  },




router.post('/create_stream', (req, res) => {
  console.log('req',req);
  middleware.decryption(req.body, function (request) {
   
    var rules = {
       
    }
    const messages = {
      required: req.language.required,
      in: req.language.in,
      required_if: req.language.required_if,
      required_unless: req.language.required_unless,
    };
    if (middleware.checkValidationRules(request, res, rules, messages, {})) {
      chat_model.create_stream(req.user_id, request, function (responsecode, responsemsg, responsedata) {
        middleware.sendresponse(req, res, 200, responsecode, responsemsg, responsedata);
      }
      );
    }
    });
})