info Overview

Endpoint

POST /api.php

Purpose

Create Google Chat spaces

Response

Streaming JSON

This API accepts the exact same data structure as the web form, making it easy to programmatically create spaces with the same options available in the UI.

send Request Structure

{
  "clientName": "ACME Corporation",
  "location": "Sydney",
  "jobNumber": "12345",
  "spaces": [
    {
      "prefix": "A",
      "name": "A: ACME Corporation - Sydney (12345)",
      "members": ["[email protected]", "[email protected]"],
      "managers": ["[email protected]"]
    }
  ]
}

Field Descriptions

  • clientName (required) - The client/company name
  • location (required) - Client location
  • jobNumber (required) - Job/project identifier
  • spaces (required) - Array of spaces to create
    • prefix - Space type (e.g., "A", "S", "IT", "V")
    • name - Full space name
    • members - Array of member email addresses
    • managers - Array of manager email addresses (must be in members)

science API Testing Interface

Request Configuration

menu_book Example Scenarios

Custom Example

E1: 49588 - Broad - Ferny Grove with both users as managers

Single Space

Create one administrative space

Standard Setup

Create all standard spaces (A, S, IT, V)

Custom Teams

Different teams for each space

code Code Examples

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "clientName": "ACME Corporation",
    "location": "Sydney",
    "jobNumber": "12345",
    "spaces": [
      {
        "prefix": "A",
        "name": "A: ACME Corporation - Sydney (12345)",
        "members": ["[email protected]", "[email protected]"],
        "managers": ["[email protected]"]
      }
    ]
  }' \
  https://your-domain.com/api.php
async function createSpaces(clientData) {
  const response = await fetch('https://your-domain.com/api.php', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(clientData)
  });

  // Handle streaming response
  const reader = response.body.getReader();
  const decoder = new TextDecoder();
  
  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    
    const chunk = decoder.decode(value);
    const lines = chunk.split('\n').filter(line => line.trim());
    
    for (const line of lines) {
      const update = JSON.parse(line);
      console.log(`[${update.status}] ${update.message}`);
      
      if (update.progress !== undefined) {
        console.log(`Progress: ${update.progress}%`);
      }
    }
  }
}
import requests
import json

def create_spaces(client_data):
    response = requests.post(
        'https://your-domain.com/api.php',
        headers={'Content-Type': 'application/json'},
        json=client_data,
        stream=True
    )
    
    for line in response.iter_lines():
        if line:
            update = json.loads(line)
            print(f"[{update['status']}] {update['message']}")
            
            if 'progress' in update:
                print(f"Progress: {update['progress']}%")

# Example usage
create_spaces({
    'clientName': 'ACME Corporation',
    'location': 'Sydney',
    'jobNumber': '12345',
    'spaces': [
        {
            'prefix': 'A',
            'name': 'A: ACME Corporation - Sydney (12345)',
            'members': ['[email protected]', '[email protected]'],
            'managers': ['[email protected]']
        }
    ]
})
<?php
function createSpaces($clientData) {
    $ch = curl_init('https://your-domain.com/api.php');
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($clientData));
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Content-Type: application/json'
    ]);
    curl_setopt($ch, CURLOPT_WRITEFUNCTION, function($ch, $data) {
        $lines = explode("\n", trim($data));
        foreach ($lines as $line) {
            if ($line) {
                $update = json_decode($line, true);
                echo "[{$update['status']}] {$update['message']}\n";
                
                if (isset($update['progress'])) {
                    echo "Progress: {$update['progress']}%\n";
                }
            }
        }
        return strlen($data);
    });
    
    curl_exec($ch);
    curl_close($ch);
}

// Example usage
createSpaces([
    'clientName' => 'ACME Corporation',
    'location' => 'Sydney',
    'jobNumber' => '12345',
    'spaces' => [
        [
            'prefix' => 'A',
            'name' => 'A: ACME Corporation - Sydney (12345)',
            'members' => ['[email protected]', '[email protected]'],
            'managers' => ['[email protected]']
        ]
    ]
]);
?>

description Documentation