ONTAP Rest API Discussions

Query - get record name that has curly braces in it.

MOHANRAJB
203 Views

Hi,


Trying to get the qtree name that has curly braces in it. ex - {cjtest-really-long-name}

if tried name: {cjtest-really-long-name} without double quotes around the name, it did not return the qtree record.

curl -X GET "https://host_ip/api/storage/qtrees?name=%7Bcjtest-really-long-name%7D&return_records=true&return_timeout=15" -H "accept: application/json" -H "authorization: Basic YWRtaW46bmV0YXBwMSE="


whereas with double quotes "{cjtest-really-long-name}", it return record good.

curl -X GET "https://host_ip/api/storage/qtrees?name=%22%7Bcjtest-really-long-name%7D%22&return_records=true&return_timeout=15" -H "accept: application/json" -H "authorization: Basic YWRtaW46bmV0YXBwMSE="


is this expected?


Thanks,

Mohan

1 ACCEPTED SOLUTION

RobertBlackhart
154 Views

Yes, this is expected. There are 3 ways to quote a string value in the ONTAP API (and CLI). Single quotes ('value'), double quotes ("value") or curly braces, {value}. If the value you are quoting contains one of those characters, you'll need to quote it with a different set so as to have those embedded quote characters treated literally.

View solution in original post

2 REPLIES 2

RobertBlackhart
155 Views

Yes, this is expected. There are 3 ways to quote a string value in the ONTAP API (and CLI). Single quotes ('value'), double quotes ("value") or curly braces, {value}. If the value you are quoting contains one of those characters, you'll need to quote it with a different set so as to have those embedded quote characters treated literally.

You are correct except for single quotes. ONTAP doesn't treat single quotes as special. BTW, if a string's first and last characters are open and shut curly braces, the rest is treated as literal, even with emdedded curly quotes. So {x}yz} is same as "x}yz" and {x{}y} is same as "x{}y".

Public