-
Notifications
You must be signed in to change notification settings - Fork 85
Passing Data
In BlockCypher SDK, each object representation of JSON in Rest API, is represented as a BlockCypherModel Object. All these classes lives inside \BlockCypher\Api namespace. To send/receive any data from BlockCypher, you need to create an instance of respective BlockCypherModel, and use functions provided by the object, to make function calls like create, delete, update, execute, list, etc.
As we saw in Adding Configurations, we created an instance of WebHook
and use set*
methods to insert data into $webHook
object. The other ways to inject similar data is as follows:
You could directly pass the JSON string as BlockCypherModel constructor parameter, and BlockCypher SDK will fill the information accordingly. You could use get*
methods to retrieve specific information about the object immediately after that. Here is the example.
$webHook = new \BlockCypher\Api\WebHook(
'{
"url": "https://requestb.in/slmm49sl?uniqid=554790ee32b4d",
"event": "unconfirmed-tx"
}'
);
// This will print the id
echo $webHook->getId();
Similarly, array could be passed too as a constructor parameter to BlockCypherModel Object, as shown below:
$webHook = new \BlockCypher\Api\WebHook(
array(
"url" => "https://requestb.in/slmm49sl?uniqid=554790ee32b4d",
"event" => "unconfirmed-tx"
)
);
// This will print the id
echo $webHook->getId();
This ability to accept multiple data formats allow developers to create instance of BlockCypherModels with minimal interference.
Getting Started
Using Our SDK
Configurations
Extras
External Links