Buraco avatar

Steem Connect v2 with Postman & PHP Lib

ikidnapmyself

Published: 01 Jun 2018 › Updated: 01 Jun 2018Steem Connect v2 with Postman & PHP Lib

Steem Connect v2 with Postman & PHP Lib

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.
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

Leave Steem Connect v2 with Postman & PHP Lib to:

Written by

Time traveller in spare times.

Read more #utopian-io posts


Best Posts From Buraco

We have not curated any of ikidnapmyself's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Buraco