API Documentation (deprecated) - cryptocracy/flows GitHub Wiki

(Closed Beta is now over, this repo is deprecated)

API version (1.1.96)


End Points

All parameters to determine the calls intent are defined in the payload, which is encoded with a JWT secret

/get?jwt=encodedheader.encodedpayload.signature (GETs)

/post?jwt=encodedheader.encodedpayload.signature (POSTs)

sample header

{
  "alg": "HS256",
  "typ": "JWT"
}

GET Account Deposit Address

Endpoint: /get?jwt=encodedheader.encodedpayload.signature

payload to encode:

{
  "method": "get",
  "request": "deposit",
  "admin": true
}

sample successful response:

{  
   "address":"14R9L5eCYsjESojSEWsy3okAHcHdzAHRuZ",
   "message":"Send bitcoins to the address specified."
}

GET Account Deposit Address Balance

Endpoint: /get?jwt=encodedheader.encodedpayload.signature

payload to encode:

{
  "method": "get",
  "request": "balance",
  "admin": true
}

sample successful response:

{  
   "addresses":[  
      {  
         "address":"14R9L5eCYsjESojSEWsy3okAHcHdzAHRuZ",
         "bitcoin":0.00772523,
         "satoshis":772523
      }
   ],
   "total_balance":{  
      "bitcoin":0.00772523,
      "satoshis":772523
   }
}

GET Account Owned Projects

Endpoint: /get?jwt=encodedheader.encodedpayload.signature

payload to encode:

{
  "method": "get",
  "request": "owned",
  "admin": true
}

sample successful response:

{
  "addresses": [
    {
      "address": "3PevMZrF8zp5rQ4uHmaVmETfbXXdmGG3Cq",
      "names_owned": [
        "cryptocracy.id",
        "pr01-3d279xmacdklazzj2vfyvd90.id"
      ]
    }
  ],
  "names_owned": [
    "cryptocracy.id",
    "pr01-3d279xmacdklazzj2vfyvd90.id"
  ]
}

(warning: nonalpha and nonbeta versions of Souq, will have Project names that do not include a pr01- prefix, and will live in a different namespace then the .id)


GET Price Estimate of Project by ID

Endpoint: /get?jwt=encodedheader.encodedpayload.signature

sample payload to encode:

{
  "method": "get",
  "request": "price",
  "id": "pr01-3d279xmacdklazzj2vfyvd90",
  "admin": true
}

sample successful response:

{
    "name_price": {
        "btc": "6.25e-05",
        "satoshis": "6250"
    },
    "preorder_tx_fee": {
        "btc": "0.0012101",
        "satoshis": "121010"
    },
    "register_tx_fee": {
        "btc": "0.00121008",
        "satoshis": "121008"
    },
    "total_estimated_cost": {
        "btc": "0.00490291",
        "satoshis": "490291"
    },
    "update_tx_fee": {
        "btc": "0.00242023",
        "satoshis": "242023"
    },
    "warnings": [
        "Insufficient funds; fees are rough estimates."
    ]
}

POST New Project

Endpoint: /post?jwt=encodedheader.encodedpayload.signature

sample payload to encode

{
   "method": "post",
   "request": "register",
   "admin": true,
   "contacts":{
      "website":"cryptocracy.io",
      "phone":"888-747-1337",
      "email":"[email protected]"
   },
   "childof":"",
   "bitcoin":{
      "goal":"1.23",
      "address":"1LhbrBMnicrPYAouVyNTcSFBQjDrZBQ18G"
   },
   "coordinates":{
      "latitude":"45.4210968",
      "longitude":"-122.6645186"
   },
   "children":{

   },
   "project":{
      "category":"Roads",
      "type":"donation",
      "stage": "In Progress",
      "detail":"We need to fix the pot hole on 1st street",
      "title":"fix_pothole_on_1st_st"
   },
   "image":{
      "url":"github.com/cryptocracy/images/blob/master/sample_pothole.jpg"
   },
   "v":"1.1.96",
   "id":"pr01-3d279xmacdklazzj2vfyvd90.id"
}

sample successful response

{
    "message": "The name has been queued up for registration and will take a few hours to go through. You can check on the status at any time by running 'blockstack info'.",
    "success": true,
    "transaction_hash": "THETXHASH"
}

GET Project Details by Registered ID

Endpoint: /get?jwt=encodedheader.encodedpayload.signature

sample payload to encode

{
  "method": "get",
  "request": "lookup",
  "id": "pr01-3d279xmacdklazzj2vfyvd90",
  "admin": true
}

sample successful response

{
  "contacts": {
    "website": "cryptocracy.io",
    "phone": "888-747-1337",
    "email": "[email protected]"
  },
  "childof": "",
  "bitcoin": {
    "goal": "1.23",
    "address": "1LhbrBMnicrPYAouVyNTcSFBQjDrZBQ18G"
  },
  "coordinates": {
    "latitude": "45.4210968",
    "longitude": "-122.6645186"
  },
  "children": {

  },
  "project": {
    "category": "Roads",
    "type": "donation",
    "stage": "In Progress",
    "detail": "We need to fix the pot hole on 1st street",
    "title": "fix_pothole_on_1st_st"
  },
  "image": {
    "url": "https://github.com/cryptocracy/images/blob/master/sample_pothole.jpg"
  },
  "v": "1.1.96",
  "id": "pr01-3d279xmacdklazzj2vfyvd90.id"
}

GET List of Projects by Proximity

Endpoint: /get?jwt=encodedheader.encodedpayload.signature

sample payload to encode

{
  "method": "get",
  "request": "search",
  "search": "proximity",
  "longitude": -113.3777907,
  "latitude": 32.9313444,
  "distance": 2000,
  "unittype": "km",
  "admin": true
}

sample successful response

[
  [
    "pr01-mdf9kesl9v92lclivkrfcgt1.id",
    "409.5664"
  ],
  [
    "pr01-0hqqjxzz4fon8v0sa6xdnxja.id",
    "1414.4784"
  ],
  [
    "pr01-3d279xmacdklazzj2vfyvd90.id",
    "1415.3619"
  ],
  [
    "pr01-33u8oz9a3n5wu6pomej9s39r.id",
    "1612.7078"
  ]
]