javascript examples for API usage