作者:bbylooserxd_597 | 来源:互联网 | 2023-09-07 18:31
MyappreceivesathirdpartyPOSTcallbackfromtheHelloSignAPIwitheventdata.我的应用程序接收来自HelloS
My app receives a third party POST callback from the HelloSign API with event data.
我的应用程序接收来自HelloSign API的第三方POST回调,其中包含事件数据。
Problem is, I can't seem to get "inside" the json to parse it and save the data.
问题是,我似乎无法“进入”json来解析它并保存数据。
class HelloSignController
The event data received from params[:json]:
来自params的事件数据[:json]:
{
"event": {
"event_type": "signature_request_sent",
"event_time": "1394642012",
"event_hash": "xxxxx"
},
"account_guid": null,
"client_id": "xxxx",
"signature_request": {
"signature_request_id": "xxxxxxx",
"title": "Review Agreement",
"original_title": "Review Agreement",
"message": null,
"test_mode": true,
"is_complete": false,
"final_copy_uri": "/v3/signature_request/final_copy/xxxxx",
"files_url": "https://api.hellosign.com/apiapp.php/v3/signature_request/files/xxxxx",
"details_url": "https://www.hellosign.com/home/manage?locate=xxxxx",
"requester_email_address": "xxxxxxx",
"signatures": [
{
"signature_id": "xxxxx",
"has_pin": false,
"signer_email_address": "xxxx@gmail.com",
"signer_name": "admin",
"order": null,
"status_code": "awaiting_signature",
"signed_at": null,
"last_viewed_at": null,
"last_reminded_at": null
}
]
}
}
How can I parse "j" to save the "event_type" and the "signature_request_id" for example?
如何解析“j”来保存“event_type”和“signature_request_id”?
Thanks
谢谢
Also: this is the actual callback from the console:
另外:这是控制台的实际回调:
Started POST "/hs_callback" for 127.0.0.1 at 2014-03-12 13:32:38 -0400
Processing by HelloSignController#receives_data as */*
Parameters: {"json"=>"{\"event\":{\"event_type\":\"signature_request_sent\",\"event_time\":\"1394645254\",\"event_hash\":\"xxxxx\",\"event_metadata\":{\"related_signature_id\":\"\",\"reported_for_account_id\":null,\"reported_for_app_id\":\"xxxxx\",\"event_message\":null}},\"account_guid\":null,\"client_id\":\"xxxxx\",\"signature_request\":{\"signature_request_id\":\"xxxx\",\"title\":\"Review Agreement\",\"original_title\":\"Review Agreement\",\"subject\":null,\"message\":null,\"test_mode\":true,\"is_complete\":false,\"has_error\":false,\"custom_fields\":[],\"response_data\":[],\"signing_url\":null,\"signing_redirect_url\":null,\"final_copy_uri\":\"\\/v3\\/signature_request\\/final_copy\\/xxxxxx\",\"files_url\":\"https:\\/\\/api.hellosign.com\\/apiapp.php\\/v3\\/signature_request\\/files\\/xxxxxxx\",\"details_url\":\"https:\\/\\/www.hellosign.com\\/home\\/manage?locate=xxxxxx\",\"requester_email_address\":\"xxxxx@maildrop.cc\",\"signatures\":[{\"signature_id\":\"xxxxx\",\"has_pin\":false,\"signer_email_address\":\"xxxxxx@gmail.com\",\"signer_name\":\"xxxxxxx\",\"order\":null,\"status_code\":\"awaiting_signature\",\"signed_at\":null,\"last_viewed_at\":null,\"last_reminded_at\":null}],\"cc_email_addresses\":[]}}"}
2 个解决方案