2.6.10.2 Python

In this example, we use the get_id_from_name function that we defined in Obtaining the Server Pool ID Value to obtain the file system ID value for a file system with the name "nfs:/mnt/vol1/repo01". We use this value to construct the URI where we need to submit the POST request required to create the repository.

...
fsid=get_id_from_name(s,baseUri,'FileSystem',"nfs:/mnt/vol1/repo01")
data={
        'name': 'MyRepository',
}
uri='{base}/FileSystem/{fsid}/Repository'.format(base=baseUri, fsid=fsid['value'])
r=s.post(uri,data=json.dumps(data))
job=r.json()
# wait for the job to complete
repo_id=wait_for_job(job['id']['uri'],s)