API Workflows (noob question)

I have an API response that looks something like this:

    "id": 29,
    "created_at": "2018-06-13T07:56:27.952Z",
    "updated_at": "2018-06-13T07:56:27.952Z",
    "allocation_line_items": [
            "id": 17203336,
            "quantity": 4,
            "sellable": {
                "product": {
                    "id": 1437675,
                    "title": "Logitech B100 Optical Mouse",
                    "main_image_src": "https://amazonaws.com/images/1812778/logi-black_original.jpg?146125"
                "stock_entries": [
                        "id": 18874385,
                        "sellable_id": 3281766,
                        "warehouse_id": 24020,
                        "infinite": false,
                        "allocated_stock_level": 4,
                        "location": null,
                        "stock_running_low": true,
                        "updated_at": "2018-06-12T20:11:18.836Z",
                        "incoming_stock_level": 3,
                        "warehouse": {
                            "id": 24020,
                            "name": "DE Warehouse",
                            "display_position": 1
                        "physical_stock_level": 0,
                        "available_stock_level": -4,
                        "sellable_on_hand_value": 0
                        "id": 3081548,
                        "sellable_id": 3281766,
                        "warehouse_id": 805,
                        "infinite": false,
                        "allocated_stock_level": 0,
                        "location": "Row 6 - Shelf C",
                        "stock_running_low": false,
                        "updated_at": "2018-06-12T20:11:07.730Z",
                        "incoming_stock_level": 0,
                        "warehouse": {
                            "id": 805,
                            "name": "Main Warehouse",
                            "display_position": 5
                        "physical_stock_level": 5,
                        "available_stock_level": 5,
                        "sellable_on_hand_value": 0

I’ve setup a workflow that triggers a scheduled api workflow on a list called create-batch

Here’s an image of the endpoint settings for create-batch

the only action I have for this scheduled workflow is to create a new thing called location in the type batch 2.

it creates this from “allocation_line_items”: [“stock_entries”: [“location”]] in the response pasted above.

When the data gets saved into the Bubble server it looks like this. 7 repeating instances of a list of all locations.

instead I need it to be a list of each 7 instance of the location. so instead of:

  1. , Shelf 1 A, , , bin location 7, Shelf B,
  2. , Shelf 1 A, , , bin location 7, Shelf B,
  3. , Shelf 1 A, , , bin location 7, Shelf B,
  4. , Shelf 1 A, , , bin location 7, Shelf B,
  5. , Shelf 1 A, , , bin location 7, Shelf B,
  6. , Shelf 1 A, , , bin location 7, Shelf B,
  7. , Shelf 1 A, , , bin location 7, Shelf B,

it should be:
2. Shelf 1 A
6. bin location 7
7. Shelf B

I’m sure it’s something simple that i’ve overlooked but there doesn’t seem much available in the form of documentation for scheduled workflows

Have you tried using a condition for is empty (null) location fields?

@scottb50 Thanks for getting back to me! :smiley:
I tried that but the condition field would not accept the option I put in

Also, if it did accept that wouldn’t the result be something like:

  1. Shelf 1 A
  2. bin location 7
  3. Shelf B

Instead of:
2. Shelf 1 A
6. bin location 7
7. Shelf B

You’re passing all the locations in one go, you need to specify that they are separate locations.

In your create batch API workflow, create an additional parameter called location.

Then in the schedule API workflow on list define the location as 'this show batch…'s location.

Something along those lines, I can’t make screenshots now :stuck_out_tongue:

Hey @vincent56 that sounds like we’re on the right track with this. I think I’ve followed your steps but I still get the following result:

This is what I did:

  1. On the api workflow endpoint I added a parameter with a key location and type text. (note: I also tried an attempt with “Is a list/array” toggled on and off. Same result both time)

  2. In the event to schedule the api workflow I set the “location” to [This show batch sellable stock_entrie’s][location]

Did I miss something obvious?


Can you make location part of the list to run on?

@vincent56 you mean like this?

To select location as part of list to run I had to change
Type Of Things: Text

also the param changed to This text

When it was run it saved the following

How is your api connector set up?

Maybe there is an issue with the way you are bringing in the language parameter…

@vincent56 I’m using a custom plugin I created to generate the requests.

Here’s my settings for that specific call if that’s what you mean?

And the returned value type setting for location

Can you create a repeating group and set it up so it displays the locations in separate cells?

Yea i’ve managed to do that like this (but it doesn’t include empty cells):

Create repeating group that calls the api

Create a text field that shows the current groups text

If you set it up as text ‘This text’, how do you create the batch item?

@vincent56 sorry i’ve got a little confused. The repeating group in the post above was pulling from the api and not the bubble db. I can’t seem to be able to show 1 location on individual rows in a repeating group if I try and use the saved data from the db

No that is fine, the fact that you can separate locations from the API means you can also save them as such. Could you share the editor?

Link removed

I think this is the issue:

What page are you running it from?

I’m running it from the page picking

API seems to throw an error but if it would work as before, the api workflow should now create separate locations

Awesome! Thanks so much!!! :smiley:

1 Like

Did this work?