Hello Everyone,
I have developed a console application to upload base64-encoded documents. The application is scheduled to run every 5 minutes using Windows Task Scheduler.Sometime I'm encountering an authorization issue while trying to perform a specific function on the API calls. I would appreciate any help or insights you can provide regarding this error.
Error Message:
Authorization failed. You are not authorized to perform this function.
Context:
I'm currently working on integrating our application with the Hexagon EAM using the REST API. I'm attempting to make a request to the "upload document" endpoint in order to upload a new document.
Authentication Method:
I'm using basic authentication to authenticate my requests. I'm providing the username and password in the Authorization header using the "Basic" scheme.
Expected Behavior: I expect the API to upload the document with the provided details and return a success response with the newly upload document`s information.
Additional Information: I have verified that the provided username and password are correct. I have also double-checked the API documentation to ensure that I'm using the correct endpoint and the required fields in the request payload.
Help Needed: I would greatly appreciate any assistance or insights you can provide to help me troubleshoot this authorization issue. If you have encountered a similar problem or have any suggestions on what might be causing this error, please share your thoughts.
Thank you in advance for your time and help!
Best regards,
Ajaz Khan

Mohamed Azarudeen ZPosted May 26, 2023, 9:10 AM
Hi ajaz can you try these troubleshoots,
Check the API documentation: Double-check the API documentation for the "upload document" endpoint to ensure that you are using the correct endpoint URL, HTTP method (such as POST), and request payload structure. Make sure you are including all the required fields and their values in the request.
Verify the authentication credentials: Although you mentioned that you have verified the provided username and password, it's worth double-checking them again. Ensure that the credentials you are using for basic authentication are correct and have the necessary permissions to perform the "upload document" function.
Test the API using a different tool: Try using a different tool, such as a REST client like Postman or cURL, to manually send a request to the API's "upload document" endpoint with the same authentication credentials and request payload. This can help isolate the issue and determine if it's related to your console application or something else.
Check for additional authorization requirements: Some APIs may have additional authorization requirements, such as including specific headers or tokens in the request. Review the API documentation thoroughly to ensure you are fulfilling all the necessary authorization requirements.
Review error logs or error details: Check if there are any additional error logs or details available that can provide more insights into the authorization issue. The API's response or any server-side logs may contain additional information that can help pinpoint the problem.
Contact the API provider's support: If you have followed the above steps and are still encountering the authorization issue, it might be beneficial to reach out to the support team or developer community of the Hexagon EAM API. They may have specific insights or troubleshooting steps to help you resolve the problem.
this might narroedown the prblem