This topic is locked

Project REST API

10/5/2025 09:25:21
PHPRunner General questions
M
Moinul author

I am not able to make it work.

Trying to Do Some API call from outside.

I build may app With PHPRUNNER Now I want to call some data from anaother APP i will pull data from the PHPRUNNER app to my other app.

not able to do it.

I am using on Active Directory Authontication only.

I have tried makeing a new small app jut to test that also not working, access denied all time.

Anyone can help me?

ChatGPT 10/5/2025

Certainly! To make API calls from one application to another using PHPRunner, especially when authentication is involved (like Active Directory), there are a few steps and considerations to take into account. Here’s a general approach to troubleshoot and set up your API calls:

Steps to Set Up API Access in PHPRunner

  1. Enable API in PHPRunner:

    • In your PHPRunner project, ensure that the API functionality is enabled. You can do this in the project settings.
    • Go to Settings > API and make sure that API access is turned on.


  2. Create API Endpoints:

    • Define the API endpoints that you want to access. This could be done by creating a dedicated page for the API calls or by using existing pages.
    • Ensure that the data you want to expose via API is configured correctly.


  3. Check Authentication Settings:

    • Since you are using Active Directory for authentication, ensure that your API is set up to handle the authentication properly.
    • You may need to implement token-based authentication or session management. PHPRunner will rely on the authentication method you set up.


  4. Test API Locally:

    • Before calling it from another app, test the API locally using a tool like Postman or cURL. Make sure you can access the API and retrieve data without issues.
    • Use the same authentication method that your other app will use.


  5. Handling Access Denied Errors:

    • If you are receiving "Access Denied" errors, verify that the user account you are using to authenticate has the appropriate permissions to access the API.
    • Check your Active Directory settings to ensure the user is part of the correct groups.
    • Review the security settings in PHPRunner to ensure that the API endpoints are accessible to the user roles you intend.


  6. CORS Issues:

    • If your other app is running in a different domain, ensure that Cross-Origin Resource Sharing (CORS) is configured correctly in your PHPRunner application to allow requests from your external app.


  7. Debugging:

    • Use error logging in PHPRunner to capture any errors that occur during the API call. This can help you identify what is going wrong.
    • Check the server logs for any related error messages.


  8. Documentation and Support:

    • Refer to the PHPRunner documentation for specific details on API configuration and usage.
    • If you continue to experience issues, consider reaching out to PHPRunner support or forums where you can get help from other users.



Example API Call

If you are using cURL to test your API, a sample call might look like this:

curl -X GET "http://your-phprunner-app/api/your-endpoint" -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Conclusion

By following these steps, you should be able to set up and troubleshoot API calls from your PHPRunner application. Make sure to validate each part of the process, especially the authentication and permissions, as these are often the culprits when facing access issues. If problems persist, consider providing additional details about the errors you're encountering for more tailored assistance.

Sergey Kornilov admin 10/5/2025

You need to explain what exactly is the issue. Show exact error messages and/or screenshots.

"not able to make it work" doesn't really explain anything.

M
Moinul author 10/5/2025

img alt
I have added screenshot

Sergey Kornilov admin 10/6/2025

You cannot make REST API work with Active Directory, Active Directory is meant for interactive user login only. You need to use Database authentication.

Please refer to this article:
https://xlinesoft.com/phprunner/docs/about-rest-api.htm