03 December 2021

How to Return a List of Org Spaces and Apps within your Podio Workspace Using Data Sync

If you need to return a list of all the Organisation Spaces and Apps in your Podio organisation then here is a method that uses Data Sync Project Automation to call the Podio API to list all Spaces and Apps and write them into a Podio App.

You can Download the Data Sync Project file to get started, then follow the steps below. The sample project contains the project automation code you need to run you just need to connect to your Podio App.

The Project Automation Code that this project uses can be seen below:

using Simego.DataSync.Providers.Podio;

class ProjectAutomationOverride : Simego.DataSync.Automation.ProjectAutomationShim 
{    	
	public override void Start()
	{
		DataSourceA.GetDataTableCallback += GetDataTableSource;
	}
	
	public DataTableStore GetDataTableSource(DataTableStoreCallbackInfo info)
    {                                            		
		dynamic schema = DataSourceB.Podio.JsonRequest(new Uri("https://api.podio.com/org/"), "GET");

        foreach (var org in schema)
        {				
            foreach (var space in org["spaces"])
            {
				dynamic apps =  DataSourceB.Podio.JsonRequest(new Uri(string.Format("https://api.podio.com/app/space/{0}/", space["space_id"])), "GET");
				if(apps.Length > 0)
				{
					foreach(var app in apps)
					{
						info.Store.Rows.Add(info, (o, columnName) => {
							
							if(columnName == "OrgID")
							{
								return org["org_id"];
							}
							
							if(columnName == "OrgName")
							{
								return org["name"];
							}
							
							if(columnName == "SpaceID")
							{
								return space["space_id"];
							}
							
							if(columnName == "SpaceName")
							{
								return 	space["name"];
							}
							
							if(columnName == "AppID")
							{
								return app["app_id"];
							}
							
							if(columnName == "AppName")
							{
								return 	app["config"]["name"];
							}

							return null;
						});
					}
				}
            }
        }
										
        return info.Store;
    }

Create a Podio App

Before starting you need make sure you have a Podio App ready to hold the data we will be returning. The project automation code will get the Podio API token from the connection to this app.

Podio App

Connect to Podio

Open the sample project from above and connect to your Podio App that will hold the organisation, space and app data.

If you have already connected to Podio and saved the connection to the connection library you can just drag the app into the target window.

Connection Library Drag & Drop

Schema Mapping

The schema mapping should automatically configure itself, however please check to make sure that each column is mapped to the correct corresponding column in Podio.

It should look similar to this:

Schema Map

Run the Compare

Run the compare by clicking Compare A->B in the toolbar. You can preview the results by clicking onto the green plus to view the additions.

Compare Results

Then click Synchronise and Start to run the sync. The results will then be populated in the App with all the Spaces and Apps in the Organisation.

Completed Results