example api usage with javascript