热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Webhook:如何在我的视图中显示响应

我正在使用一个API,该API可让我检查用户是否已连接到任何帐户(Amazon,Ebay,Prestash

我正在使用一个API,该API可让我检查用户是否已连接到任何帐户(Amazon,Ebay,Prestashop等)。
建立连接后,我在JSON中收到一个类似以下内容的网钩:

Parameters: {"connection"=>{"informations"=>{},"connector_uuid"=>"3180ba23-2b75-5abe-b14d-69a42835474d","id_user"=>626,"created"=>"2019-12-26 10:03:41","id_provider"=>940,"error_message"=>nil,"last_push"=>nil,"last_update"=>"2019-12-26 10:03:45","connector"=>{"sync_frequency"=>nil,"code"=>nil,"uuid"=>"3180ba23-2b75-5abe-b14d-69a42835474d","documents_type"=>["bill"],"color"=>"c8ee20","auth_mechanism"=>"credentials","capabilities"=>["document"],"id"=>470,"available_auth_mechanisms"=>["credentials"],"beta"=>true,"months_to_fetch"=>nil,"urls"=>["https://addons.prestashop.com"],"siret"=>nil,"hidden"=>false,"charged"=>true,"slug"=>"PRE","categories"=>[],"name"=>"PrestaShop"},"active"=>true,"state"=>nil,"expire"=>nil,"accounts"=>[],"error"=>nil,"subscriptions"=>[{"id_source"=>604,"documents"=>[],"id_user"=>696,"deleted"=>nil,"id_connection"=>708,"number"=>"test01@gmail.com","validity"=>nil,"label"=>"test@gmail.com","subscriber"=>"John Doe","currency"=>nil,"disabled"=>nil,"error"=>"bug","id"=>550,"formatted_balance"=>nil,"renewdate"=>nil,"balance"=>nil,"last_update"=>nil}],"next_try"=>"2019-12-27 14:03:45","id_connector"=>440,"id"=>608},"push_type"=>"partial_history","user"=>{"signin"=>"2019-12-26 10:03:08","platform"=>"sharedaccess","id"=>626},"invoice"=>{"connection"=>{"informations"=>{},"id_user"=>926,"id_provider"=>480,"id"=>440,"subscriptions"=>[{"id_source"=>699,"id_connection"=>608,"label"=>"compere01@gmail.com","id_connector"=>490,"id"=>908},"id"=>626}}}

您知道如何在我的视图中显示此JSON吗?

我在控制器中尝试过:

def webhooks
render json: response.body,status: 200
puts response.body.inspect
end

但是在我看来没有任何反应,我在控制台中有JSON,但我的put呈现了一个空字符串。


参数 ,而不是 response.body

def webhooks
render json: params,status: 200
puts params
end

推荐阅读
author-avatar
疯子zls_565
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有