EcoStruxure IT forum
Schneider Electric support forum about installation and configuration for DCIM including EcoStruxure IT Expert, IT Advisor, Data Center Expert, and NetBotz
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:43 PM . Last Modified: 2024-04-08 12:06 AM
(CID:122687586)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:43 PM . Last Modified: 2024-04-08 12:06 AM
Hi Vasileios Baousis
The links that Ed Tarento posted should get you started. Did you see the video on the first page: " Introduction to RESTful API"?
The following:
curl -X GET --header 'Accept: application/json' 'https://: @ /api/v8.1/assets/search?q= '
Will return information about the asset with the name 'assetname'.
username and password are the credentials of the user that you want to use for your webservice calls. Server IP is the ip address of your DCO server. Finally assetname is the name of the asset you are looking for.
I added the -k option to allow an insecure connection (assuming that your server got the default self signed certificate)
Hope it helps.
/Anders
(CID:122688107)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:43 PM . Last Modified: 2024-04-08 12:06 AM
Hi Vasileios
Might not be the examples you're looking for but some useful links
(CID:122687708)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:43 PM . Last Modified: 2024-04-08 12:06 AM
Thanks for your answer and the links. I have gone through these and I cannot see any meaningful example.
Let me explain : A very simple API call like
curl -X GET --header 'Accept: application/json' 'https://DCO.somewhere.com/api/v8.1/assets/search?q=$ASSET_NAME'
it does not work from a system other than the system running DCO server. Does not make any sense to have an API that can be used only from the system running DCO server.
The idea is that you can call the DCO API from any system (providing valid credentials -in my case I am the admin of the DCO) and retrieve some information from DCO.
I would like something like that to work
curl --insecure -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
"password": "$PASSWORD",
"user": {
"username": "$USENAME",
}
}' 'https://DCO.somewhere.com/api/v8.1/assets/search?q=$ASSET_NAME'
Then I try this command I get
The WSDL for inventory is still working in DCO ?(in https://dcimsupport.apc.com/display/public/DCIMDEVELOPER/StruxureWare+Data+Center+Operation+Web+Serv...) it says that is depricated and is replaced by the Asset Service but these is nothing in this page about the "Asset Service". Any documentation about the new calls would be helpful.
Thanks in advance
(CID:122687984)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:43 PM . Last Modified: 2024-04-08 12:06 AM
The query https://DCO.somewhere.com/api/v8.1/assets/search?q=$ASSET_PROPERTY' always returns the first 50 items. Is there any way to increase the number of the return items?
I have configured 300+ and I cannot get a full list of my Configuration Items (CIs) through the API!!!
Thanks,
(CID:122692257)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:43 PM . Last Modified: 2024-04-08 12:06 AM
Hi Vasileios Baousis
The links that Ed Tarento posted should get you started. Did you see the video on the first page: " Introduction to RESTful API"?
The following:
curl -X GET --header 'Accept: application/json' 'https://: @ /api/v8.1/assets/search?q= '
Will return information about the asset with the name 'assetname'.
username and password are the credentials of the user that you want to use for your webservice calls. Server IP is the ip address of your DCO server. Finally assetname is the name of the asset you are looking for.
I added the -k option to allow an insecure connection (assuming that your server got the default self signed certificate)
Hope it helps.
/Anders
(CID:122688107)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:43 PM . Last Modified: 2024-04-08 12:06 AM
I have tried all these options.... The only problem was that if the password contains some special characters (most security policies dictate to include special characters) the password has to be converted to a valid ASCII format.Therefore, I used something like https://www.w3schools.com/tags/ref_urlencode.asp
and the curl commands works without a problem.
Thanks,
Vasilis
(CID:122688245)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:43 PM . Last Modified: 2024-04-08 12:06 AM
Cool - now you can move on to building some good tools and utilities using the webservices !
/Anders
(CID:122688636)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:43 PM . Last Modified: 2024-04-08 12:06 AM
Hello again,
The query https://DCO.somewhere.com/api/v8.1/assets/search?q=$ASSET_PROPERTY' always returns the first 50 items. Is there any way to increase the number of the return items?
I have configured 300+ and I cannot get a full list of my Configuration Items (CIs) through the API!!!
Thanks,
(CID:122691218)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:44 PM . Last Modified: 2024-04-08 12:06 AM
For performance reasons the "GET /assets/search" API will not return more than 50 assets.
To get all assets you will have to do multiple requests. You can go through all assets by starting with the "GET /assets" request.
From the ids you get from that request you can then use the "GET /assets/{asset-id}" request with the include option children to get all the contained assets together with the ids of their children. With the ids of the children you can then again use the "GET /assets/{asset-id}" request to get the data about those assets.
(CID:123346463)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:44 PM . Last Modified: 2024-04-08 12:06 AM
Don't have any inventory related stuff yet but below is a very rough Python program that reads a list of user accounts from a csv file and adds them as users. It's not complete but you should be able to see how the API call are made (if you know Python)
import requests
import logging
import csv
user_url = 'https://192.168.56.195/api/v8.1/users'
groups_url = 'http://192.168.56.195/api/v8.1/user-groups'
login_name = 'apc'
login_password = 'apc123'
import_file='C:\\Users\\mfoley\\PycharmProjects\\UserLoad\\userdata.csv'
logging.basicConfig(level=logging.DEBUG)
def main():
#fetch_groups()
process_file()
def process_file():
logging.debug('Processing file ' + import_file)
with open(import_file) as csv_file:
reader = csv.DictReader(csv_file)
for row in reader:
logging.debug('Processing row number: %s : %s', reader.line_num, row)
user_name = row['username']
password = row['pw']
create_normal_user(user_name )
def create_normal_user(user_name):
payload = {'password': 'theB3st', 'user':{'username': user_name, 'email': 'wally'}}
r = requests.post(user_url, json=payload, auth=(login_name , login_password),verify=False )
if r.status_code != 204 :
logging.error('Failed to add:' + user_name + "Message:" + r.content)
print(r)
def create_ad_user(user_name😞
print('to do')
def fetch_groups():
r = requests.get(groups_url, auth=(login_name , login_password), verify=False)
data = r.json()
print(data)
def fetch_users():
r = requests.get(user_url, auth=(login_name , password),verify=False)
data = r.json()
print(data)
if __name__ == '__main__':
main()
(CID:122688426)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:44 PM . Last Modified: 2024-04-08 12:06 AM
The query https://DCO.somewhere.com/api/v8.1/assets/search?q=$ASSET_PROPERTY' always returns the first 50 items. Is there any way to increase the number of the return items?
I have configured 300+ and I cannot get a full list of my Configuration Items (CIs) through the API!!!
Thanks,
(CID:122692258)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-07-03 05:44 PM . Last Modified: 2023-10-22 04:25 AM
This question is closed for comments. You're welcome to start a new topic if you have further comments on this issue.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.