JSON request error. Mollybet API

  • (2 Pages)
  • +
  • 1
  • 2

28 Replies - 1060 Views - Last Post: 11 February 2019 - 10:59 AM Rate Topic: -----

#16 h4nnib4l   User is offline

  • The Noid
  • member icon

Reputation: 1354
  • View blog
  • Posts: 1,932
  • Joined: 24-August 11

Re: JSON request error. Mollybet API

Posted 25 January 2019 - 09:45 AM

As astonecipher pointed out, you still quote-wrapped accounts, and then escaped the inner quotes (as you are doing with everything else). Try using exactly what I gave you for accounts. "accounts":[["ibc", "_99899bb2_"]]. Don't add anything to it.
Was This Post Helpful? 0
  • +
  • -

#17 banjo121212   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 22-January 19

Re: JSON request error. Mollybet API

Posted 31 January 2019 - 07:15 AM

Thank you for all the help so far.All of the errors are now fixed except one. We are unable to proceed without user_data. Any suggestions on what input is required?
Attached Image
Was This Post Helpful? 0
  • +
  • -

#18 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2766
  • View blog
  • Posts: 10,958
  • Joined: 03-December 12

Re: JSON request error. Mollybet API

Posted 31 January 2019 - 07:32 AM

Based on this,

Attached Image


It isn't needed, so don't even include it in the request.
Was This Post Helpful? 0
  • +
  • -

#19 banjo121212   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 22-January 19

Re: JSON request error. Mollybet API

Posted 31 January 2019 - 08:41 AM

Looks like it is required. This is what happens without it.

Attached Image
Was This Post Helpful? 0
  • +
  • -

#20 h4nnib4l   User is offline

  • The Noid
  • member icon

Reputation: 1354
  • View blog
  • Posts: 1,932
  • Joined: 24-August 11

Re: JSON request error. Mollybet API

Posted 31 January 2019 - 12:38 PM

That doesn't mean it's required - the documentation states that it's optional - it simply means that input validation is finally passing and you're now getting an error one step deeper into processing of the request. Is there an authentication step that you're supposed to perform prior to hitting the "place bet" endpoint?
Was This Post Helpful? 0
  • +
  • -

#21 banjo121212   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 22-January 19

Re: JSON request error. Mollybet API

Posted 02 February 2019 - 05:52 AM

View Posth4nnib4l, on 31 January 2019 - 12:38 PM, said:

That doesn't mean it's required - the documentation states that it's optional - it simply means that input validation is finally passing and you're now getting an error one step deeper into processing of the request. Is there an authentication step that you're supposed to perform prior to hitting the "place bet" endpoint?



No, authentication is completed successfully. One of the developers from Mollybet has suggested;
"Please be advised that you opened a betslip through the web while you tried to place the bet through the API and this is why the error message appeared.".

We are waiting on a response from them to hopefully elaborate, as no bet slips were opened through their actual website, nor were we even logged in. Unless I am completely missing what they are trying to say?

If you have any more suggestions, please keep them coming. Thank you for your help so far.

The error I am referring to:
Attached Image
Was This Post Helpful? 0
  • +
  • -

#22 h4nnib4l   User is offline

  • The Noid
  • member icon

Reputation: 1354
  • View blog
  • Posts: 1,932
  • Joined: 24-August 11

Re: JSON request error. Mollybet API

Posted 03 February 2019 - 08:18 AM

How exactly are you performing the authentication?

Also, what's the response code you're getting?

This post has been edited by h4nnib4l: 03 February 2019 - 08:20 AM

Was This Post Helpful? 0
  • +
  • -

#23 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 6767
  • View blog
  • Posts: 23,071
  • Joined: 05-May 12

Re: JSON request error. Mollybet API

Posted 04 February 2019 - 06:01 PM

I think post #1 shows the step right after authentication. My understanding of the API is that the session header value needs to be set for the succeeding API calls.
Was This Post Helpful? 0
  • +
  • -

#24 h4nnib4l   User is offline

  • The Noid
  • member icon

Reputation: 1354
  • View blog
  • Posts: 1,932
  • Joined: 24-August 11

Re: JSON request error. Mollybet API

Posted 05 February 2019 - 09:32 AM

That's what I was getting at. The HttpClient the OP is using appears to be scoped to the class, so I'm assuming that an attempt at retrieving a token and assigning it in the header is happening in another method. I think we've addressed the validation issues in the code to place the bet, so we'll need more code to be able to help more.
Was This Post Helpful? 0
  • +
  • -

#25 banjo121212   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 22-January 19

Re: JSON request error. Mollybet API

Posted 07 February 2019 - 10:31 PM

I hope this helps. Thanks for the help so far.

Attached Image

Attached Image

Attached Image
Was This Post Helpful? 0
  • +
  • -

#26 banjo121212   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 22-January 19

Re: JSON request error. Mollybet API

Posted 07 February 2019 - 10:46 PM

I suspect the problem is somewhere here.
 public async Task<bool> login()
        {
            try
            {
                string loginUrl = string.Format("{0}v1/sessions/", endPonit);
                httpClient.DefaultRequestHeaders.Remove("Accept");
                httpClient.DefaultRequestHeaders.Add("Accept", "application/json");

                Account account = new Account();
                account.username = Setting.Instance.usernameMolleybet;
                account.password = Setting.Instance.passwordMolleybet;
                string postJson = JsonConvert.SerializeObject(account);

                HttpResponseMessage response = await httpClient.PostAsync(loginUrl, new StringContent(postJson, Encoding.UTF8, "application/json"));
                response.EnsureSuccessStatusCode();

                string content = response.Content.ReadAsStringAsync().Result;
                LoginResult result = JsonConvert.DeserializeObject<LoginResult>(content);
                session = result.data;
                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }


This post has been edited by Skydiver: 08 February 2019 - 04:51 AM
Reason for edit:: Put code in code tags. Please learn to do this yourself.

Was This Post Helpful? 0
  • +
  • -

#27 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 6767
  • View blog
  • Posts: 23,071
  • Joined: 05-May 12

Re: JSON request error. Mollybet API

Posted 08 February 2019 - 04:56 AM

That picture helps a little bit. Notice that in your login call, the returned result.data was "fa3d...", but in your bet slip call, the session header you were passing in was "a623...". Looks like you aren't using the result.data as your session key. So whatever session you are using on your line 19 not what you are using for your bet slip calls.
Was This Post Helpful? 0
  • +
  • -

#28 banjo121212   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 22-January 19

Re: JSON request error. Mollybet API

Posted 09 February 2019 - 09:18 PM

Thanks for the suggestion. My bad for providing misleading info. Screenshots were taken after separate log ins hence the different authentication values. I can confirm that the same data/session value is used throughout the procedure.

In regards to the feedback received from the Mollybet team (""Please be advised that you opened a betslip through the web while you tried to place the bet through the API and this is why the error message appeared.". ") ,

could they have meant that the the error comes from a betslip being initially called via pro.spormarket.com rather than api.mollybet.com?
I am still waiting for them to clarify.

This is the order of processes:
Attached Image

Could this be the issue? :
Attached Image

Response:
Attached Image
Was This Post Helpful? 0
  • +
  • -

#29 h4nnib4l   User is offline

  • The Noid
  • member icon

Reputation: 1354
  • View blog
  • Posts: 1,932
  • Joined: 24-August 11

Re: JSON request error. Mollybet API

Posted 11 February 2019 - 10:59 AM

In short, yes. You're logging into one service, and then trying to use that login to access another service. Things don't usually work that way (on purpose, at least...). In this case, you're trying to use an authentication token issued from pro.sportmarket.com on the api.mollybet.com service. I'm curious what you're trying to accomplish now. Why would you not stick with one or the other through the whole process?

If the use case is valid, then you'll need to perform a second authentication to api.mollybet.com and use that token in the session header, and only persist the betslip_id between the two (the last bit is a guess).
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2