BeanHsiang / facepp-netstandard-sdk

Face++ SDK for .NET Standard.
https://www.faceplusplus.com.cn/
MIT License
1 stars 3 forks source link

MISSING_ARGUMENTS: api_key #1

Open R00iBaard opened 5 years ago

R00iBaard commented 5 years ago

I receive that API response when I try to run the following :

var searchImageResponse = client.Face_Detect(null, image_url:"https://miro.medium.com/max/578/1*Db5cCH72jLsV5lrgdAs78Q.jpeg", return_attributes: "eyegaze", return_landmark:1);

Are you sure we are suppose to be using multipartFormDataContent when posting?

varszegimarcell commented 4 years ago

I have this problem too.

I will start an intensive debug session to find out what the hell is happening here. With a manually fabricated HTTP POST request, (using curl) I was able to communicate with the server. Somwhere is something weird happening. Maybe I will trace down the request body using wireshark, to see what has been sent out, since the request generation is pretty complex on the SDK.

varszegimarcell commented 4 years ago

BTW if you have found the solution since then, notify me :D I need this SDK hardly for my thesis, and I lack the time to implement my own from scratch.

varszegimarcell commented 4 years ago

According to the Face++ API Documentation:

Parameter You need to pass the parameters according to the requirements of each API. Please turn to the API Reference for more details. Each API request must be POST request. You can add the parameters in the form of Query String, and use multipart/form-data to upload image files.

Source: https://console.faceplusplus.com/documents/7078057

So yeah, multi-part form data is totally inappropriate for communicating with the API, except uploading images.

I think I have to rewrite the request generation totally, to be able to use this API. It's a pity. My guess is that the API accepted the parameters in multi-part form data in the past, but that has been changed since then.

If I make any progress with the rewrite, I'll make a PR.