SyncAPI error 401 while fetching logs

book

Article ID: 171401

calendar_today

Updated On:

Products

Web Security Service - WSS

Issue/Introduction

While trying to fetch real-time logs using SyncAPI technology, it throws a '401: Unauthorized' error.

'401: Unauthorized'

Environment

Windows, using a Cygwin instance to lauch WGET and cURL commands to fetch logs.
Linux, using the commands above.

Resolution

Instead of using regular cURL credential passing, such as:
curl -u apiuser:apipasswd https://portal.threatpulse.com/reportpod/logs/sync?startDate=start_date&endDate=end_date&token=token

One may insert the credentials into the header when casting the request:
curl -H 'X-APIUsername: apiuser' -H 'X-APIPassword: apipasswd' https://portal.threatpulse.com/reportpod/logs/sync?startDate=start_date&endDate=end_date&token=token

Remember to use short passwords with unreserved characters only.
Reference: https://www.ietf.org/rfc/rfc3986.txt (Section 2.3, Alphanumerics, dashes, dots, underscores and tildes.)