utkarsh867
utkarsh867

Reputation: 87

Making a request to Face++ detect API with image in base64 format

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!

Upvotes: 0

Views: 1491

Answers (1)

Mark P Neyer
Mark P Neyer

Reputation: 1009

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.

Upvotes: 1

Related Questions