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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×