I'm trying to connect to the API programmatically using curl calls from our server. I'm sending a call to /rest/v1/login/[username] to log in, followed by a call to /rest/v1/realtime/by-xid/[xid] to get the data value.
The login call works; it returns a response code of 200 and good data about the account. The second call, however, fails with 401 response (unauthorized).
I also tried setting the USERPWD curl option on the second call, which lets you send user name and password as part of the call, but got the same result (401, unauthorized).
How do you log in when making API calls using curl?