Extreme API with Python
Table Of Contents
- 1 Preface
- 2 Introduction
- 3 EXOS APIs
- 4 VOSS API
- 5 XMC API
- 6 ExtremeCloud IQ API
- 7 Extreme Campus Controller API
Extreme API with Python
Page | 100
Part no.9036931-00 Rev AA February 2021
XMC User: root
XMC User Domain:
IP: 192.168.56.121
There are 5 devices in Extreme Fabric Connect site
There are 9 devices in IP Campus site
5.3.3 GraphQL Mutation
A mutation lets you add, delete, or modify content in the XMC database. This can be potentially risky, so
be sure you are not deleting important data, or corrupting the database content.
Note: GraphQL mutation is supported in XMC 8.3 and later.
The mutation framework is the same as for query: browse the GraphiQL interface to find the format of
your CALL, and the fields to complete.
When you created a query, you did not specify the top query field in your CALL, which is the default and
as such implied. For mutation, however, you must start your CALL with the top mutation field.
To illustrate mutation, create a Python script that creates a new site. Because this is a simple script is for
demonstration, it is short. A real script and workflow would be much longer.
SiteName = "/World/NewSite"
mutation = '''
mutation {
network {
createSite(input: {siteLocation: "%s"}) {
status
message
siteId
}
}
}
''' % SiteName
res = emc_nbi.mutation(mutation)
print "\nData returned: ", res
if res['network']['createSite']['status'] != "SUCCESS":
print "\nCannot create Site {} because {}".format(
SiteName,
res['network']['createSite']['message'])










