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
    • YouTube Videos
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Agility
      • Book your Agile Fundamentals training
      • Book you Kanban workshop
      • Learn more about 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)
    • >> Go to DataMiner Docs
  • DevOps
    • About the DevOps Program
    • Sign up for the DevOps Pogram
    • DataMiner DevOps Support
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
  • Downloads
  • Contact
    • Sales, Training & Certification
    • DataMiner Support
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Solutions
    • Deal Registration
  • >> Go to dataminer.services

API Calls to Dataminer

Solved1.57K views18th July 2023
1
Daniel Ragol-Levy [DevOps Member] 21st June 2021 0 Comments

Hi Team,

https://help.dataminer.services/WebServices/#t=SLC_UM_DataMinerWebServices%2FWS_Methods_v0%2FConnect.htm

Can anyone please help me to understand why the following python code to make an API call to dataminer does not work

import requests

headers1 = {
“host”: “localhost”,
“Content-Type”: “application/x-www-form-urlencoded”
}

data1 = {
“Login”: “XXX”,
“Password”: “XXX”,
“connection” : “10df979a-6bbd-412b-9182-66a38f0ec4eb”,
“dmaID”:”41303″,
}

r = requests.post(“http://10.207.7.224/api/v0/Connection”, headers = headers1, data=data1)

print(r.text)

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 18th July 2023

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
1
Wim Bruynooghe [SLC] [DevOps Advocate]6.59K Posted 21st June 2021 3 Comments

I would recommend to use JSON with the v1 interface:

import requests

headers1 = {
“Accept”: “*/*”,
“Content-type”: “application/json”
}

data1 = {
“host”: “localhost”,
“login”: “XXX”,
“password”: “XXX”,
“clientAppName”: “My App”,
“clientAppVersion”: “”,
“clientComputerName”: “”
}

r = requests.post(“http://10.207.7.224/API/v1/Json.asmx/ConnectApp”, data=data1, headers = headers1)

Note:
– the v0 interface is deprecated.
– without using HTTPS, the password will be send unencrypted.

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 18th July 2023
Daniel Ragol-Levy [DevOps Member] commented 22nd June 2021

Thanks Wim / Miguel,

With a couple of adjustments this is looking more positive….

REQUEST
import requests

headers1 = {
“Host”: “localhost”,
“Accept”: “*/*”,
“Content-Type”: “application/json”
}

data1 = {
“host” : “localhost”,
“login”: “XXX,
“password”: “XXX”,
“clientAppName”: “drl-python”,
“clientAppVersion”: “”,
“clientComputerName”: “”
}

r = requests.post(“http://10.207.7.224/API/v1/json.asmx/ConnectApp”, headers = headers1, json=data1)

print(r.text)

RESPONSE:

{“d”:”22d9db83-852f-XXX-XXX-XXX”}

I am not trying the https://help.dataminer.services/WebServices/#t=SLC_UM_DataMinerWebServicesWS_Methods_v1_methodspt1ExecuteAutomationScript.htm

import requests

headers1 = {
“Host”: “localhost”,
“Accept”: “*/*”,
“Content-Type”: “application/json”
}

data1 = {
“connection” : “22d9db83-852f-XXX-XXX-XXX”,
“script” : {
“Name” : “Email test”,
“Description” : “Daniel Test”,
“Folder”: “C:Skyline DataMinerScripts”,
“Settings” : {
“RequireInteractive” : False,
“HasFindInteractiveClient” : False
}
},
“scriptOptions” : {
“WaitForScript” : False,
“CheckSets” : False,
“LockElements” : False,
“ForceLockElements” : False,
“WaitWhenLocked”: False,
“IsInUse” : False,
“AskForConfirmation” : False,
}
}

r = requests.post(“http://10.207.7.224/API/v1/json.asmx/ExecuteAutomationScript”, headers = headers1, json=data1)

print(r.text)

RESPONSE:
{“Message”:”Error trapped: Object reference not set to an instance of an object.”,”StackTrace”:” at Skyline.DataMiner.Web.Common.v1.AutomationModule.ExecuteAutomationScript(String connection, DMAAutomationScript script, DMAAutomationScriptOptions scriptOptions)rn at Skyline.DataMiner.Web.v1.Json.ExecuteAutomationScript(String connection, DMAAutomationScript script, DMAAutomationScriptOptions scriptOptions)”,”ExceptionType”:”Skyline.DataMiner.Web.Common.WebApiException”}
>>>

I have not included all the variables in the script – are they all necessary and related to this issue?

Many thanks

Wim Bruynooghe [SLC] [DevOps Advocate] commented 23rd June 2021

I can’t spot the mistake here, might be something related to the Python syntax, I’m not that experienced with Python. Maybe the comma after “AskForConfirmation”: False shouldn’t be there?
Also the Folder should not contain the full path with the Skyline DataMiner directory, it’s a virtual path that you can see in the Automation module in Cube.
I tried doing the same in Postman, with the same properties defined as in your data, and it works.

Wim Bruynooghe [SLC] [DevOps Advocate] commented 24th June 2021

With DataMiner version 9.6.0, it is also necessary to specify the properties Dummies, Parameters and MemoryFiles, they can be empty arrays.

0
Miguel Obregon [SLC] [DevOps Catalyst]19.60K Posted 21st June 2021 0 Comments

Hi Daniel,

Checking the payload (‘data1’) in your question, it seems that it is not correct. According to DataMiner Help (DataMiner WebService: Connect), the following entries are required:

  • Connection: The IP address or the host name where the DMA is running
  • Login: User name
  • Password: The password

Based on this, the payload ‘data1’ should be defined as follows:

data1 = {

“Connection” : “10.1.2.3”,

“Login”: “myUser”,

“Password”: “myPassword”

}

The result of this query will be the connection ID (in your case, this is stored in the variable ‘r’). With the connection ID, you can start querying data from the DMA.

Miguel Obregon [SLC] [DevOps Catalyst] Answered question 21st June 2021
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