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
    • Agility
      • Kanban workshop
      • Agile Fundamentals
    • 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
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
    • Global Feedback Survey
  • Support
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

Implement a curl request in a HTTP session

Solved1.20K views2nd February 2023API connection curl restful
6
Dominique Bodart [DevOps Member]705 2nd February 2023 0 Comments

Hi,

I try to implement a HTTP REST API driver to monitor some equipment from a website which requires some authentication. The provider provides some detail example on curl and Postman which works fine. But how to implement the authentication parameter in the HTTP session? Here follow the curl request (I just replaced the 'client_id & _secret by dummy value):

curl --location --request POST 'https://api-knt.skylogic.com/ext/api/v1/whs/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=xxxxxx' \
--data-urlencode 'client_secret=yyyyyy'

And so far my HTTP session looks like that in Dataminer:

<HTTP>
<Session id="1" name="Get Token">
<Connection id="1" name="Get Token">
<Request verb="POST" url="/ext/api/v1/whs/oauth2/token">
<Headers>
<Header key="Content-Type">application/x-www-form-urlencoded</Header>
</Headers>
</Request>
<Response statusCode="100">
<Content pid="200"/>
</Response>
</Connection>
</Session>
</HTTP>

It is triggered by a button and the server is sending back some error info message in JSON (Err. 500) as the authentication is not yet implemented. At least it proves the request is sent but I am stuck to how to "translate" the full curl request in the driver:

{"timestamp":1675335822712,"status":500,"error":"Internal Server Error","path":"/api/v1/whs/oauth2/token","id":"051334ef-9c53-49e8-a131-15e061ae5e7c.","message":null,"trace_id":"ebff834954eff057","span_id":"d41a198b1a4737c4"}

Ben Vandenberghe [SLC] [DevOps Enabler] Selected answer as best 2nd February 2023

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
9
Laurens Moutton [SLC] [DevOps Enabler]8.89K Posted 2nd February 2023 7 Comments

Hi,

The parameters grant_type, client_id, client secret will still need to be included.

That can be done on 2 possible ways:

  • A parameter will have as value the full content of the post body. See this help section
  • Or specify them as parameter format, for more info see this help section (for example <Parameter key="grant_type">client_credentials</Parameter> <Parameter key="client_id" pid="215" />, for grant_type this is a fixed value, for client_id the value will be stored in parameter with id 215

Note when using a GET that it will add the parameters in the URL already url encoded (with ampersand between every item). For a POST this will add it to the body. I'm not 100% sure it will be url encoded in that case, it could be that it will still needs to be some qaction logic in between before filling in the parameter value (that would need to be tested out)

Michiel Clepkens [SLC] [DevOps Advocate] Posted new comment 20th October 2023
Dominique Bodart [DevOps Member] commented 2nd February 2023

Many thanks Laurens, very helpful 🙂
So I implemented the credentials as you advised and it works fine for that POST:

client_credentials

application/x-www-form-urlencoded

In fact this POST generates a token that I will have to extract with a QAction to be able to use other commands. Once again, thank you very much

Laurens Moutton [SLC] [DevOps Enabler] commented 2nd February 2023

Hi Dominique, I’m glad to hear that the info could help. If the provided answer is sufficient, would it be possible to click on the check mark beneath the upvote/downvote icons (has the tooltip “Select this answer as best.”)? This way the question will be marked as solved

Ben Vandenberghe [SLC] [DevOps Enabler] commented 2nd February 2023

I’ve done it Laurens – and you can do that as well as a matter of fact, if a question is solved anybody is welcome to mark it as solved. Because indeed it is good to keep a bit of hygiene on these things.

PS: the feedback you gave, is that also documented somewhere in docs.dataminer.services for future reference?

Bert Vandenberghe [SLC] [DevOps Enabler] commented 2nd February 2023

Small correction: Only the person asking the question, or an admin or moderator, can mark an answer as best answer. So, you are probably an admin or moderator. Laurens probably not.

Laurens Moutton [SLC] [DevOps Enabler] commented 3rd February 2023

I can only mark an answer as best answer if I’m the one that posted the question. If somebody else posted a question then I cannot mark something as best answer.
About the feedback that I gave: I did some further lookup on docs.dataminer.services and found a nice explanation with examples about the usage of “Data” and “Parameter” when used with a “GET” or a “POST” in this link: https://docs.dataminer.services/develop/devguide/Connector/ConnectionsHttpImplementing.html#request

Show 2 more comments
You are viewing 1 out of 1 answers, click here to view all answers.
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

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin