Capmonster cloud help for api request

Vladimir99

Client
Регистрация
14.02.2019
Сообщения
34
Благодарностей
2
Баллы
8
Hello,

I try to create post request for capmonster cloud (getBalance just for start), but i have some problemes

I did post request url : https://api.capmonster.cloud/getBalance
Data : Content-Type:application/json
clientKey:myapikey

Result :
HTTP/1.1 403 Forbidden
Server: nginx/1.14.0 (Ubuntu)
Date: Mon, 15 Jun 2020 09:26:14 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 147
Connection: keep-alive


{"errorId":1,"errorCode":"ERROR_KEY_DOES_NOT_EXIST","errorDescription":"Account authorization key not found in the system or has incorrect format"}

If you can help me or send me template to use capmonster cloud api to resolve captcha it will be great

Regards
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 224
Благодарностей
5 843
Баллы
113
Could you please attach JSON part of your request.
There seems to be some wrong parameter.
 

Vladimir99

Client
Регистрация
14.02.2019
Сообщения
34
Благодарностей
2
Баллы
8
ok i find issue, thank for your help
 

manalsabbah

Новичок
Регистрация
10.11.2020
Сообщения
8
Благодарностей
0
Баллы
1
I want to post my problem but I can't :(
I had the same error u got but I can't solve it

this is my code
c#
-------------

capmonster captcha:
        private static readonly string Token = "key";
        private static readonly CapMonsterClient client = new CapMonsterClient(Token);
        private  async Task RecaptchaAsync(string img)
        {
            string base64=GetBase64StringForImage(img);
            var captchaTask = new ImageToTextTask
            {
                Body= "data:image/jpeg;base64,"+base64,
                CapMonsterModule= "yandexnew"
            };
            int taskId;
            try
            {
                taskId = await client.CreateTaskAsync(captchaTask);
            }
            catch (CapMonsterException er)
            {
                Program.loger("RecaptchaAsync Erorr" + er.ErrorCode + "\r\n" + er.ErrorDescription);
                return;
            }
            try
            {
                var solution = await client.GetTaskResultAsync<ImageToTextTaskResult>(taskId);
                var solinput = FindElement("//html//body//div[2]//div[9]//div//div//div[1]//div//div[2]//div//div[1]//div[4]//div//div//div//div//div[2]//div//div//div[2]//input", new FindElementBy(), true);
                solinput.SendKeys(solution.Text);
                var sendbtn = FindElement("//html//body//div[2]//div[9]//div//div//div[1]//div//div[2]//div//div[1]//div[4]//div//div//div//div//div[3]//button", FindElementBy.XPath, true);
                sendbtn.Click();
            }
            catch (CapMonsterException er)
            {
                Program.loger("RecaptchaAsync Erorr" + er.ErrorCode + "\r\n" + er.ErrorDescription);
                return;
            }

        }
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 224
Благодарностей
5 843
Баллы
113
I want to post my problem but I can't :(
I had the same error u got but I can't solve it

this is my code
c#
-------------

capmonster captcha:
        private static readonly string Token = "key";
        private static readonly CapMonsterClient client = new CapMonsterClient(Token);
        private  async Task RecaptchaAsync(string img)
        {
            string base64=GetBase64StringForImage(img);
            var captchaTask = new ImageToTextTask
            {
                Body= "data:image/jpeg;base64,"+base64,
                CapMonsterModule= "yandexnew"
            };
            int taskId;
            try
            {
                taskId = await client.CreateTaskAsync(captchaTask);
            }
            catch (CapMonsterException er)
            {
                Program.loger("RecaptchaAsync Erorr" + er.ErrorCode + "\r\n" + er.ErrorDescription);
                return;
            }
            try
            {
                var solution = await client.GetTaskResultAsync<ImageToTextTaskResult>(taskId);
                var solinput = FindElement("//html//body//div[2]//div[9]//div//div//div[1]//div//div[2]//div//div[1]//div[4]//div//div//div//div//div[2]//div//div//div[2]//input", new FindElementBy(), true);
                solinput.SendKeys(solution.Text);
                var sendbtn = FindElement("//html//body//div[2]//div[9]//div//div//div[1]//div//div[2]//div//div[1]//div[4]//div//div//div//div//div[3]//button", FindElementBy.XPath, true);
                sendbtn.Click();
            }
            catch (CapMonsterException er)
            {
                Program.loger("RecaptchaAsync Erorr" + er.ErrorCode + "\r\n" + er.ErrorDescription);
                return;
            }

        }
Don't see where you pass API-key for CM cloud in your code
 

manalsabbah

Новичок
Регистрация
10.11.2020
Сообщения
8
Благодарностей
0
Баллы
1
Don't see where you pass API-key for CM cloud in your code
private static readonly string Token = "key";
private static readonly CapMonsterClient client = new CapMonsterClient(Token);

I thought by this I pass the key?
--------------------------------------
and I try to use postman to pass API and same issue happened
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 224
Благодарностей
5 843
Баллы
113
private static readonly string Token = "key";
private static readonly CapMonsterClient client = new CapMonsterClient(Token);

I thought by this I pass the key?
--------------------------------------
and I try to use postman to pass API and same issue happened
by this you declare, not pass
What is JSON result of you code?
Please attach it.
 

manalsabbah

Новичок
Регистрация
10.11.2020
Сообщения
8
Благодарностей
0
Баллы
1

manalsabbah

Новичок
Регистрация
10.11.2020
Сообщения
8
Благодарностей
0
Баллы
1

manalsabbah

Новичок
Регистрация
10.11.2020
Сообщения
8
Благодарностей
0
Баллы
1
how I can pass the API then? can you tell me, please.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 224
Благодарностей
5 843
Баллы
113

manalsabbah

Новичок
Регистрация
10.11.2020
Сообщения
8
Благодарностей
0
Баллы
1

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)