How to traverse a list with leaf as a key element

Assuming you already have a maapi socket and transaction handle, you can use combination of maapi_init_cursor() and maapi_get_next()

Something like

struct maapi_cursor mc;

maapi_init_cursor(ms, thandle, &mc, "/path/to/list");
int i;

for (maapi_get_next(&mc), i = 0; 
     mc.n > 0;
     maapi_get_next(&mc))
{
     // printf ("Data[%d]: %s\n", i++, CONFD_GET_CBUFPTR(&mc.keys[0])); 
}

maapi_destroy_cursor(&mc);