Skip to Content Skip to Menu

Archiving json data in a CB field with auto action ?

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
2 years 8 months ago #328248 by activha
Hi Kyle

Following our move to CB Activity for our activations and with the great possibilities offered by your plugins, i’d like to study a follow up.

Using a CB activity data (ie our new activ param field, location/place and category param), we’d like to curl an external API to retrieve some json data.

This curl is for instance :
Code:
https://serpapi.com/search.json?engine=google&q=Coffee&location=Austin%2C+Texas%2C+United+States&google_domain=google.com&gl=us&hl=en&api_key=YOUR_API_KEY

We then repeat 4 times this request with 4 different keywords and will make some calculations to try to find the number of occurrences the field activ appears and what are the differences between the 4 requests.

Then we would display the results with something like observablehq.com/@d3/chord-diagram

An example of 4 json responses following a Curl after a CB Activity is :
serpapi.com/searches/4b8dcf92a25deef2/61d59b9c1baebbcd0f66b023.json
serpapi.com/searches/548ddc4cc90e4084/61d59bd0ca968fbadf779c41.json
serpapi.com/searches/58715fee22472fab/61d59beed5ecf417939c4ce5.json
serpapi.com/searches/ccffe4792c0e57a7/61d59bffb7b1cce9cafebd44.json

I need to archive/save these responses and make the calculations after and was wondering whether Community Builder fields and auto actions could be used for this or if we need to code from scratch.

Is there any kind of CB Field that we could use to archive these json datas with a reference to the CB Activity id ?
that could be 4 fields or a single combined one

What could be the trigger to do this after a CB Activity with a specified asset including %.activation.% is made ?
so that it happens in the background and only the result is displayed. I would not want the CURL to be done at each display.

Don’t know if we can use CB for all this but that would be great if possible ;-)

thanks for sharing your comments

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
2 years 8 months ago #328252 by krileon
We've no functionality for that and unlikely ever will, sorry. Best I can suggest is use a Code action with Method set to PHP in CB Auto Actions and write all the necessary PHP to do what you're needing to do. There is a Request action for sending HTTP requests, but it'll convert JSON response data it a key value pair HTML layout and has no functionality for setting up storage behavior.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum