Skip to Content Skip to Menu

API save to Cb Activity and Gallery

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
2 years 8 months ago #328114 by activha
API save to Cb Activity and Gallery was created by activha
Hello

Following
my move from com_hotspots to CB Activity, I’d like to finish it by writing an auto action to get the data from our iOS/android application into CB.

For now we have the application which sends data and images received by hotspots API under a save task and the format is then :
Code:
$data = $this->input->get('data', '', 'raw'); $images = $this->input->get('images', '', 'raw');

where $images are photo files and $data is a json like
Code:
{ "category": 88, "activ": "test hotspot #1", "street": "4 rue de Rivoli", "plz": "75004", "town": "Paris", "administrative_area_level_1": "Ile-de-France", "country": "France", "gmlat": "48.85529", "gmlng": "2.361394", "message": "test hotspot #1", "published": "0", "customfields": "" }

In order to avoid breaking the native apps, is it possible to have an auto action in CB to save all this in a new activity and return its id ?

As I need to save both images/videos in CB Gallery and CB Activity, could you point me to what I need to do ?

Thanks a lot

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 #328123 by krileon
Replied by krileon on topic API save to Cb Activity and Gallery

In order to avoid breaking the native apps, is it possible to have an auto action in CB to save all this in a new activity and return its id ?

The CB Activity action type doesn't return anything when doing creations or deletions, but will review pushing a quick new build where the object is added to the substitutions so you can access it via [action_object] and for id would be [action_object_id]. You'd then just use the built in Output feature to output it as whatever format you want.

forge.joomlapolis.com/issues/8847

As I need to save both images/videos in CB Gallery and CB Activity, could you point me to what I need to do ?

Only way that'd work is you'd need to load the file data into _FILES global or encode the image into raw data string and pass that through. Take a look at saveItemEdit in component.cbgallery.php for the file data handling. If you store that externally you could just use the CB Gallery action type to generate a media link to it though and then you don't have to deal with trying to perform a file upload.


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.

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
2 years 8 months ago #328125 by activha
Replied by activha on topic API save to Cb Activity and Gallery
Great ! thanks :-)

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 - 2 years 8 months ago #328128 by krileon
Replied by krileon on topic API save to Cb Activity and Gallery
Have to consider for a future release how I want to best implement that action object handling since most actions with objects have more than 1 object. Will be looking into it more in the future, but it'll likely only be available for PHP based layouts via something like $autoaction->objects() which would give an array of objects returned by the action and you'd need to loop through them as needed.

So for now I don't have an immediate solution for you beyond maybe querying for that information in the PHP layout or something of the sort.


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.
Last edit: 2 years 8 months ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum