0

I am trying to send an image to the Face++ Detect API using the image_base64 parameter. However I receive an error:

414 Request-URI Too Large

414 Request-URI Too Large

The requested URL's length exceeds the capacity limit for this server.

I am using the following code to make the request:

function sendImageProcess(img_64) {
    var url = "https://api-us.faceplusplus.com/facepp/v3/detect";
    request({
        uri: url,
        method: 'POST',
        qs: {
            api_secret: fpp_pass,
            api_key: fpp_key,
            return_attributes: "gender",
            image_base64: img_64,
            return_landmark: "1"
        }
    },function (error, response) {
        if(!error){
            console.log(response.body);
            return response.body;
        }
        else{
            console.log(error);
        }
    });
}

Here img_64 is base64 string of the image.

Maybe, I do not understand the way I am required to send the image_base64 parameter.

The img_64 string looks like:

data:image/jpeg;base64,/9j/4RSJRXhpZgAATU0AKgAAAAgADAEAAAMAAAABAawAAAEBAAMAAAABAn0AAAECAAMAAAADAAAAngEGAAMAAAABAAIAAAESAAMAAAABAAEAAAEVAAMAAAABAAMAAAEaAAUAAAABAAAApAEbAAUAAAABAAAArAEoAAMAAAABAAIAAAExAAIAAAAkAAAAtAEyAAIAAAAUAAAA2Idp.........and so on

I am hoping that someone could help me out.

Thanks!

utkarsh867
  • 87
  • 1
  • 10

1 Answers1

1

It worked for me after i chopped off the 'data:image/jpeg;base64,' portion, although if your image is too big, i'd start there.

Mark P Neyer
  • 1,009
  • 2
  • 8
  • 19
  • Thank a lot! I did try that though and I guess the image was too big. However I got it to work later using formData. Thanks again! – utkarsh867 Sep 13 '17 at 08:33