Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Empower Replay: Limited Edition
    • Tutorials
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
      • About the DevOps Program
      • DataMiner DevOps Support
  • Downloads
  • More
    • DataMiner Releases & Updates
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

User definable API returns status code 200, but comes in as status code 500

Solved911 views22nd February 2024User Definable API user defined API User-Defined
2
Toon Casteele [SLC] [DevOps Enabler]7.00K 22nd February 2024 0 Comments

I’m accessing a user definable API through a service webhook in Azure DevOps. I can tell from my information event logging that the script runs completely fine. At the end of the script I do this.

        return new ApiTriggerOutput
{
ResponseCode = (int)StatusCode.Ok,
};

But in Azure DevOps I get an internal server error with code 500.

If my request is in an incorrect format, I have some checks in my script that then return something like this:

            return new ApiTriggerOutput
{
ResponseBody = $”Azure DevOps project with id {workItem.resourceContainers.project.id} is not supported”,
ResponseCode = (int)StatusCode.BadRequest,
};

These response codes come in correctly into Azure DevOps.

What’s happening?

EDIT: Full response:

Status Code: 500
Reason Phrase: Internal Server Error
HTTP Version: 1.1
Headers:
{
Connection: keep-alive
Request-Context: appId=cid-v1:e6146ee8-8f7e-4826-92a9-9e3220cf1975
TunnelConnection: 04f72ccd-573f-4ea4-abf7-aeff6b604a18
TunnelForwarded: True
Strict-Transport-Security: max-age=15552000; includeSubDomains
SL-Filter: ALLOWED (single request, by path), time=2024-2-22 9:10:45
Content-Security-Policy: frame-ancestors ‘self’
X-Content-Type-Options: nosniff
X-Frame-Options: deny
Date: Thu, 22 Feb 2024 08:10:45 GMT
Set-Cookie: TunnelConnection=04f72ccd-573f-4ea4-abf7-aeff6b604a18; path=/; secure; httponly
Content-Length: 235
Content-Type: application/json; charset=utf-8
}

Toon Casteele [SLC] [DevOps Enabler] Selected answer as best 22nd February 2024

3 Answers

  • Active
  • Voted
  • Newest
  • Oldest
3
Thomas Ghysbrecht [SLC] [DevOps Enabler]4.84K Posted 22nd February 2024 1 Comment

Hi Toon,

Can you check the SLUserDefinableApiManager.txt log file? This may reveal what may have gone wrong when the API script response is being handled.

The current internal test version had an issue where an API would fail when you did not define any response body. Can you check if that DMA is running a test version and does not use a response body? The next official release won’t have this issue.

Toon Casteele [SLC] [DevOps Enabler] Selected answer as best 22nd February 2024
Toon Casteele [SLC] [DevOps Enabler] commented 22nd February 2024

Indeed, specifying a response body fixes the issue. Thanks for the help!

2
Jeroen Neyt [SLC] [DevOps Advocate]2.35K Posted 22nd February 2024 0 Comments

In the example of the response that is correctly coming through in Azure DevOps, you specify a ResponseBody. As that is the only difference between the 2, have you tried doing the same for the OK response to see if that makes any difference?

return new ApiTriggerOutput
{
ResponseBody = “OK”,
ResponseCode = (int)StatusCode.Ok,
};

Jeroen Neyt [SLC] [DevOps Advocate] Answered question 22nd February 2024
0
João Severino [SLC] [DevOps Catalyst]13.02K Posted 22nd February 2024 3 Comments

Hi Toon,

Usually, a 500 error code could indicate an unhandled exception in the code.

Do you receive anything in the response body besides de error code?

Toon Casteele [SLC] [DevOps Enabler] Posted new comment 22nd February 2024
Toon Casteele [SLC] [DevOps Enabler] commented 22nd February 2024

The return output you see is the last part of my code, preceeded with an engine.GenerateInformation(“Finished script”);. This message does get generated into my information events, so nothing more is happening.

I’ll edit the full response I see into the question.

João Severino [SLC] [DevOps Catalyst] commented 22nd February 2024

I just saw your edit and in this part where it mentions ‘Content-Length: 235’ it would lead me to believe that a body is available but I do not see it.
It could be that it is being trimmed somewhere in Azure but its content could give you an indication of what is failing.

Toon Casteele [SLC] [DevOps Enabler] commented 22nd February 2024

I was wondering the same thing haha. Kind of surprises me that I never get the body in there. Would need to try to figure out how to find it in Azure DevOps.

Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs