Hi Max,
yes, as Adam states, a 500 error is probably due to some error in your request call to JAM...otherwise it would be a 404 or something. Do you have a screenshot?
Did you sign your request correctly with the key?
I could share some code with you...it is written in PHP and quite complicated due to some different libraries I am using. But if your steps 1 to 3 are fine, then the 4. should be a breeze.
Cheers