NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

ONTAP Rest API Discussions

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

MOHANRAJB
2,839 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
2,790 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
2,791 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.

degraaf
2,775 Views

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