How do I query an api?

0 favourites
  • 4 posts
From the Asset Store
Integrate Telegram Payments API into your Construct 3 projects for seamless in-app payment processing.
  • This is the example code the site gave me,

    curl \

    -X POST \

    -H "Content-Type: application/json" \

    -H "X-API-KEY: YOU API KEY" \

    --data '{ "query": "{ bitcoin { blocks {count} } }" }' \

    graphql.bitquery.io

    I tried to replicate it in construct, but this is the best I could do. I think it's the data section that is giving me issues

    If you could tell me how to write the code or link some reference material, that would be great, thanks :)

    Tagged:

  • This is the example code the site gave me,

    curl \

    -X POST \

    -H "Content-Type: application/json" \

    -H "X-API-KEY: YOU API KEY" \

    --data '{ "query": "{ bitcoin { blocks {count} } }" }' \

    https://graphql.bitquery.io/

    I tried to replicate it in construct, but this is the best I could do. I think it's the data section that is giving me issues

    If you could tell me how to write the code or link some reference material, that would be great, thanks :)

    Please, don't do that. Your users could steal the API key. If you have a server, make a config file outside your public_html folder with the Api key or any authentication needed. Then, make a php file which loads the keys, and make a script which sends the POST data received from construct3, to the third party application. (check online, how to handle POST PHP, and how to send POST PHP) There are thousands of tutorials.

    So, it would be: Construct 3 post to > your php file post to > bitquery.io. Then, you can return any result to construct3 from the php file you made. This would allow you also to manipulate the data before sending it back to Construct 3.

    Make sure to check the data in the PHP file for validation, and make a sort system security which accepts requests only from the construct 3 app.

  • Official C3 ajax plugin does not support this, I recommend you learn to use javascript in construct 3, then you can create a custom function.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Cool, thanks for the replies guys. I'll see what I can do :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)