Steem Connect v2 with Postman & PHP Lib

in #utopian-io6 years ago (edited)

Hello everyone who wants to build something on Steemit!

If you are familiar with APIs, you must know Postman and JSON. I would like to share a Postman importer file to let you try using Steem with Postman. You may use it to build (d)apps and so on...

Activation Problem

Steem provides many opportunities but testing and learning needs more resources. It was pretty hard to start for us in the beginning with the API but I hope it will make the proccess easier.

Action

There is something important in this case. You should have an access token, issued by Steem Connect and the token should has access to proceed the operations. For further reading:

OAuth2
SteemConnect v2 - OAuth2 Scopes
An example usage of these with Laravel Socialite (PHP Framework)

There is also ready to use version of SteemConnect v2 for PHP developers. We have used it in our project named DNGO.

See this JSON file @GitHubGist

{
  "info": {
    "name": "Steem Connect v2",
    "_postman_id": "",
    "description": "",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Steem API Me",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "ACCESS_TOKEN",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [],
        "body": {},
        "url": {
          "raw": "https://v2.steemconnect.com/api/me",
          "protocol": "https",
          "host": [
            "v2",
            "steemconnect",
            "com"
          ],
          "path": [
            "api",
            "me"
          ]
        },
        "description": ""
      },
      "response": []
    },
    {
      "name": "Upvote",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "ACCESS_TOKEN",
              "type": "string"
            }
          ]
        },
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\"operations\":[[\"vote\",{\"voter\":\"ikidnapmyself\",\"author\":\"tubi\",\"permlink\":\"steel-welfare-studies-part-1-dmania-bot-upvote-analysis-lorenz-curve-and-gini-coefficient-of-upvote-distribution\",\"weight\":\"10000\"}]]}"
        },
        "url": {
          "raw": "https://v2.steemconnect.com/api/broadcast",
          "protocol": "https",
          "host": [
            "v2",
            "steemconnect",
            "com"
          ],
          "path": [
            "api",
            "broadcast"
          ]
        },
        "description": ""
      },
      "response": []
    },
    {
      "name": "Post",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "ACCESS_TOKEN",
              "type": "string"
            }
          ]
        },
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\r\n\"operations\": [\r\n[\r\n\"comment\",\r\n{\r\n\"parent_author\": \"\",\r\n\"parent_permlink\": \"steemconnect\",\r\n\"author\": \"ikidnapmyself\",\r\n\"permlink\": \"im-posting-with-steem-connect-apiv2\",\r\n\"title\": \"I'm posting with Steem Connect APIv2!\",\r\n\"body\": \"It is a test post. Everything looks cool! There is no documentation in my pocket, so I do it on main network.<br>Cheers!\",\r\n\"json_metadata\": \"\"\r\n}\r\n]\r\n]\r\n}"
        },
        "url": {
          "raw": "https://v2.steemconnect.com/api/broadcast",
          "protocol": "https",
          "host": [
            "v2",
            "steemconnect",
            "com"
          ],
          "path": [
            "api",
            "broadcast"
          ]
        },
        "description": ""
      },
      "response": []
    },
    {
      "name": "Leave a comment",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "ACCESS_TOKEN",
              "type": "string"
            }
          ]
        },
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\r\n    \"operations\": [\r\n        [\r\n            \"comment\",\r\n            {\r\n                \"parent_author\": \"ikidnapmyself\",\r\n                \"parent_permlink\": \"im-posting-with-steem-connect-apiv2\",\r\n                \"author\": \"ikidnapmyself\",\r\n                \"permlink\": \"permalink-sample\",\r\n                \"title\": \"\",\r\n                \"body\": \"It is my second comment!\",\r\n                \"json_metadata\": \"{\\\"app\\\":\\\"fornaxstudio\\\"}\"\r\n            }\r\n        ]\r\n    ]\r\n}"
        },
        "url": {
          "raw": "https://v2.steemconnect.com/api/broadcast",
          "protocol": "https",
          "host": [
            "v2",
            "steemconnect",
            "com"
          ],
          "path": [
            "api",
            "broadcast"
          ]
        },
        "description": ""
      },
      "response": []
    }
  ]
}

Contribution

I hope it will work for your future projects. And I am able to accept your pull-requests for the repo of DNGO @ GitHub. We will enjoy your contributions.

Proof of Work

DNGO.PNG

Sort:  

perfect ,,, i like with successful people like you. sorry if wrong with my comment !! thanks.

thanks for your kindness

Thank you for your contribution. According to Utopian Guidelines "Updates on Own Projects may be committed directly, without a Pull Request. To be considered for potential reward, commits should not be older than 14 days." The last update made on your GitHub Repo (https://github.com/dngo-io/steem-connect) is more than a month.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.030
BTC 62684.33
ETH 2456.60
USDT 1.00
SBD 2.66