Jump to content
paparoll

PD5 GraphQL new API

Recommended Posts

Hello,

All was going nice and easy then a new API arrived. I don't mind so much learning how to code with the new one but the documentation is very light.

Queries work fine for me but that's all I manage to do.

My understanding is that I need to login (with a mutation) first but I am stuck at the "catpcha" field. How do I know what to enter there?!?

Thanks,

Paparoll

Share this post


Link to post
Share on other sites

You can login within the graphql interface (https://api.primedice.com/graphql) by using:

mutation {loginUser(name: "", password:"")}

This way you can test out mutations and queries that require authentication from within the graphql interface provided.

As mentioned above by @toohoola, authentication within any programming you are doing can be done so with the x-access-token. I will work on expanding on the documentation here on the forum once I get a chance, to help provide further assistance.

Share this post


Link to post
Share on other sites

Hi and thank you both, that really helped steering me in the right direction.

Still I would like to request your help once more.

I have now successfully coded a couple functions in my Java application posting a JSON through httpurlconnection. I got the x-access-token from the browser and send it through setRequestProperty("Authorization","Bearer <token>") but the mutation rollDice keeps answering "null" ie not bet.

Could you please help me with that? I am confident that once I past this I will be all fine.

Thanks!

My bad, I got it, thanks!

Am I not making a mistake sending my token like that, shouldn't it be encrypted/hashed or something?

Share this post


Link to post
Share on other sites

Hi @Dan

I am trying to use the graphql api and i send the api token x-access-token in the http header. But when I try to use any restricted api, I get the below error:

{
  "errors": [
    {
      "path": [
        "depositList"
      ],
      "message": "Your API key doesn't have the permission to do this.",
      "errorType": "restrictedScope"
    }
  ],
  "data": null
}

Do I need to do anything to get access or am I doing something wrong.

 

Thanks

Share this post


Link to post
Share on other sites
On 13/05/2019 at 03:54, prashblah said:

Hi @Dan

I am trying to use the graphql api and i send the api token x-access-token in the http header. But when I try to use any restricted api, I get the below error:


{
  "errors": [
    {
      "path": [
        "depositList"
      ],
      "message": "Your API key doesn't have the permission to do this.",
      "errorType": "restrictedScope"
    }
  ],
  "data": null
}

Do I need to do anything to get access or am I doing something wrong.

 

Thanks

Are you adding it here? https://api.primedice.com/graphql

 

Screen Shot 2019-05-15 at 3.13.30 pm.png

Share this post


Link to post
Share on other sites
Posted (edited)

Hi Dan,

It seems like the graphql api playground page is not working anymore. Also my old mutations I had written have stopped working.

Hi @Dan

It seems like the graphql api playground page is not working anymore. Also my old mutations I had written have stopped working. Also when I try my old mutation call to roll I get error 400

Edited by prashblah

Share this post


Link to post
Share on other sites
Posted (edited)

Hi, i tried to use GraphQL API but i have some issues with my mutations.

mutation {
  primediceRoll(
    amount: 0.00000000
    target: 0.01
    condition:below
    currency: doge
  ) {
    id
    iid
    nonce
    currency
    amount
    payout
    state {
      ... on BetGamePrimedice {
        result
        target
        condition
      }
    }
    createdAt
    serverSeed {
      seedHash
      seed
      nonce
    }
    clientSeed {
      seed
    }
    user {
      name
      balances {
        available {
          amount
          currency
        }
      }
      statistic {
        game
        bets
        wins
        losses
        betAmount
        profitAmount
        currency
      }
    }
  }
}

Am I wrong ? or is it just API not working at all for mutations ? @Dan

My queries seems to still work.

Edit : I found my answer on Stake API topic

Edited by LuluBot
Stake gave me the answer

Share this post


Link to post
Share on other sites
On 15/07/2019 at 18:59, prashblah said:

Hi Dan,

It seems like the graphql api playground page is not working anymore. Also my old mutations I had written have stopped working.

Hi @Dan

It seems like the graphql api playground page is not working anymore. Also my old mutations I had written have stopped working. Also when I try my old mutation call to roll I get error 400

Hi there! :) 

Sorry for the late reply on this. API playground page has been disabled. 

You can check this topic that Dan posted for further guidance with queries:

 

 

For any assistance, feel free to post a question there on the topic. 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×