55b54d043a87a29773ca196c360a0af1346947ec
hiram
  Mon Feb 18 07:05:59 2019 -0800
the trackDb from hubs appears to be flattened ?  refs #18869

diff --git src/hg/hubApi/getData.c src/hg/hubApi/getData.c
index 835e65f..6f40d0a 100644
--- src/hg/hubApi/getData.c
+++ src/hg/hubApi/getData.c
@@ -33,61 +33,59 @@
 /* 'track' name in trackDb refers to a SQL 'table' */
 
 if (isEmpty(db))
     apiErrAbort("missing URL db=<ucscDb> name for endpoint '/getData/track");
 if (isEmpty(table))
     apiErrAbort("missing URL track=<trackName> name for endpoint '/getData/track");
 struct sqlConnection *conn = hAllocConn(db);
 if (! sqlTableExists(conn, table))
     apiErrAbort("can not find specified 'track=%s' for endpoint: /getData/track?db=%s&track=%s", table, db, table);
 
 struct jsonWrite *jw = apiStartOutput();
 jsonWriteString(jw, "db", db);
 jsonWriteString(jw, "track", table);
 char *dataTime = sqlTableUpdate(conn, table);
 time_t dataTimeStamp = sqlDateToUnixTime(dataTime);
-replaceChar(dataTime, ' ', 'T');
+replaceChar(dataTime, ' ', 'T');	/*	ISO 8601	*/
 jsonWriteString(jw, "dataTime", dataTime);
 jsonWriteNumber(jw, "dataTimeStamp", (long long)dataTimeStamp);
 
+char query[4096];
 /* no chrom specified, return entire table */
 if (isEmpty(chrom))
     {
-    char query[4096];
     sqlSafef(query, sizeof(query), "select * from %s", table);
     tableDataOutput(conn, jw, query, table);
     }
 else if (isEmpty(start) || isEmpty(end))
     {
     if (! sqlColumnExists(conn, table, "chrom"))
-	apiErrAbort("track '%s' is not a position track, request table without chrom specification, genome: '%s'", table, db);
+	apiErrAbort("track '%s' is not a position track, request track without chrom specification, genome: '%s'", table, db);
     jsonWriteString(jw, "chrom", chrom);
     struct chromInfo *ci = hGetChromInfo(db, chrom);
     jsonWriteNumber(jw, "start", (long long)0);
     jsonWriteNumber(jw, "end", (long long)ci->size);
-    char query[4096];
     sqlSafef(query, sizeof(query), "select * from %s where chrom='%s'", table, chrom);
     tableDataOutput(conn, jw, query, table);
     }
 else
     {
     if (! sqlColumnExists(conn, table, "chrom"))
-	apiErrAbort("track '%s' is not a position track, request table without chrom specification, genome: '%s'", table, db);
+	apiErrAbort("track '%s' is not a position track, request track without chrom specification, genome: '%s'", table, db);
     jsonWriteString(jw, "chrom", chrom);
     jsonWriteNumber(jw, "start", (long long)sqlSigned(start));
     jsonWriteNumber(jw, "end", (long long)sqlSigned(end));
-    char query[4096];
     sqlSafef(query, sizeof(query), "select * from %s where chrom='%s' AND chromEnd > %d AND chromStart < %d", table, chrom, sqlSigned(start), sqlSigned(end));
     tableDataOutput(conn, jw, query, table);
     }
 jsonWriteObjectEnd(jw);
 fputs(jw->dy->string,stdout);
 hFreeConn(&conn);
 }
 
 static void getSequenceData()
 /* return DNA sequence, given at least a db=name and chrom=chr,
    optionally start and end  */
 {
 char *db = cgiOptionalString("db");
 char *chrom = cgiOptionalString("chrom");
 char *start = cgiOptionalString("start");