REST api's default to json?

Hello,
1)Is there a way to make rest output default to json rather than xml?
2) If not, there is a string which i have to supply each time like application/vnd.yang.datastore+json to get output in json format or to create/update something in json format. If we wish to publish our REST api’s to customers how will they know if they want to use datastore/data/container/ ?? Is there some generic way which can be used for json.

Gopal,

1- No there is no configuration that can be done to switch the default of the REST data format from XML to JSON.

2- When you publish your REST APIs the customers you also publish the resources information. Otherwise you will be missing information and your customers wouldn’t know which resources to use for which operation.

Example:

API application/vnd.yang.api
Datastore application/vnd.yang.datastore
Data application/vnd.yang.data
Operation application/vnd.yang.operation

Take a look at the user guide: 21.4.2 for more details on the /API resource for example.