char *buildPostFields(TaskListItem *item)
{

    int str_length = strlen("{") + 1;
    char *ret_value = malloc(str_length * sizeof (char));
    strcpy(ret_value, "{");
    int added = 0;
    if (item != NULL)
    {

        if (item->title != NULL)
        {
            str_length = addQuotes(ret_value);
            str_length += strlen(TITLE_STRING);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, TITLE_STRING);
            addQuotes(ret_value);
            addColon(ret_value);
            str_length = addQuotes(ret_value);
            str_length += strlen(item->title);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, item->title);
            str_length = addQuotes(ret_value);
            added++;
        }

        if (item->id != NULL)
        {
            if (added++ > 0)
                str_length = addComma(ret_value);
            str_length = addQuotes(ret_value);
            str_length += strlen(ID_STRING);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, ID_STRING);
            str_length = addQuotes(ret_value);
            str_length = addColon(ret_value);
            str_length = addQuotes(ret_value);
            str_length += strlen(item->id);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, item->id);
            str_length = addQuotes(ret_value);
        }

        if (item->updated != NULL)
        {
            if (added++ > 0)
                str_length = addComma(ret_value);
            str_length = addQuotes(ret_value);
            str_length += strlen(UPDATED_STRING);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, UPDATED_STRING);
            str_length = addQuotes(ret_value);
            str_length = addColon(ret_value);
            str_length = addQuotes(ret_value);
            str_length += strlen(item->updated);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, item->updated);
            str_length = addQuotes(ret_value);
        }

        if (item->selfLink != NULL)
        {
            if (added++ > 0)
                str_length = addComma(ret_value);
            str_length = addQuotes(ret_value);
            str_length += strlen(SELFLINK_STRING);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, SELFLINK_STRING);
            str_length = addQuotes(ret_value);
            str_length = addColon(ret_value);
            str_length = addQuotes(ret_value);
            str_length += strlen(item->selfLink);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, item->selfLink);
            str_length = addQuotes(ret_value);
        }

        if (item->etag != NULL)
        {
            if (added++ > 0)
                str_length = addComma(ret_value);
            str_length = addQuotes(ret_value);
            str_length += strlen(ETAG_STRING);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, ETAG_STRING);
            str_length = addQuotes(ret_value);
            str_length = addColon(ret_value);
            str_length = addQuotes(ret_value);
            str_length += strlen(item->etag);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, item->etag);
            str_length = addQuotes(ret_value);
        }

        if (item->kind != NULL)
        {
            if (added++ > 0)
                str_length = addComma(ret_value);
            str_length = addQuotes(ret_value);
            str_length += strlen(KIND_STRING);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, KIND_STRING);
            str_length = addQuotes(ret_value);
            str_length = addColon(ret_value);
            str_length = addQuotes(ret_value);
            str_length += strlen(item->kind);
            ret_value = realloc(ret_value, str_length);
            strcat(ret_value, item->kind);
            str_length = addQuotes(ret_value);
        }
    }

    appendString(ret_value, "}");
    return ret_value;
}
static void rgdGene2SynonymPrint(struct section *section,
        struct sqlConnection *conn, char *rgdGeneId)
{
char *geneSym = NULL, *geneName = NULL;
char query[256], **row;
struct sqlResult *sr;
if (rgdGeneId != NULL)
    {
    safef(query, sizeof(query), 
	    "select old_symbol, old_name from genes_rat where gene_rgd_id = '%s'", 
	    rgdGeneId+4L);
    sr = sqlGetResult(conn, query);
    if ((row = sqlNextRow(sr)) != NULL)
	{
	if (row[0][0] != 0 && !sameString(row[0], "n/a"))
	    {
	    geneSym = cloneString(row[0]);
	    hPrintf("<B>Symbol:</B> %s ", addComma(row[0]));
	    //hPrintf("<BR>\n");
	    }
	if (row[1][0] != 0 && !sameString(row[0], "n/a"))
	    {
	    geneName = cloneString(row[1]);
	    hPrintf("<BR><B>Name:</B> %s ", addComma(geneName));
	    hPrintf("<BR>\n");
	    }
	}
    sqlFreeResult(&sr);

    safef(query, sizeof(query), 
	    "select value from rgdGene2ToRefSeq where name= '%s'", rgdGeneId);
    sr = sqlGetResult(conn, query);
    if ((row = sqlNextRow(sr)) != NULL)
	{
        hPrintf("<B>RefSeq Accession: </B> <A HREF=\"");
	printOurRefseqUrl(stdout, row[0]);
	hPrintf("\">%s</A><BR>\n", row[0]);
	}
    sqlFreeResult(&sr);
    
    safef(query, sizeof(query), 
	    "select value from rgdGene2ToUniProt where name= '%s'", rgdGeneId);
    sr = sqlGetResult(conn, query);
    if ((row = sqlNextRow(sr)) != NULL)
    	{
	char *spId, *spDisplayId, *oldDisplayId;
	spId = row[0];
	hPrintf("<B>Protein: </B>");
        hPrintf("<A HREF=\"http://www.uniprot.org/uniprot/%s\" "
	    "TARGET=_blank>%s</A>\n",
	    spId, spId);
    
        /* show SWISS-PROT display ID if it is different than the accession ID */
        /* but, if display name is like: Q03399 | Q03399_HUMAN, then don't show display name */
        spDisplayId = spAnyAccToId(spConn, spId);
        if (spDisplayId == NULL) 
    	    {
	    errAbort("<br>The corresponding protein %s of this gene is not found in our current UniProtKB DB.", spId);
	    }   
	
        if (strstr(spDisplayId, spId) == NULL)
	    {
	    hPrintf(" (aka %s", spDisplayId);
	    /* show once if the new and old displayId are the same */
 	    oldDisplayId = oldSpDisplayId(spDisplayId);
	    if (oldDisplayId != NULL)
 	    	{
            	if (!sameWord(spDisplayId, oldDisplayId)
                    && !sameWord(spId, oldDisplayId))
	    	    {
	    	    hPrintf(" or %s", oldDisplayId);
	    	    }  
	        }	
	    hPrintf(")<BR>\n");
	    }  
   	}
    sqlFreeResult(&sr);
    }
}