add rest authz header
adjust urls
encapsulate setting headers into function