Can WSAPI return the results in a CSV format rather than JSON?
WSAPI defaults to return a JSON structure. Yet, you can have your WSAPI queries format the results in a CSV formatted file. This can run from your browser and will download a CSV file. It can also run from software such as Postman.
To do that, you shall:
1. Append a ".csv" to your endpoint's name on the posted query.
2. Don't use 'Fetch=True'. You must specify the returned fields of your query.
3. The returned fields of your query are case sensitive. Make sure you specify them accurately. You can use the WSAPI online documentation (make sure you first login to Rally and into the workspace you need) to find out the exact field names including spelling and casing.
All other WSAPI rules and conventions apply.
Let's examine two examples:
1. Return a CSV file for all defects that contain "MyDefect" in their Name field:
https://rally1.rallydev.com/slm/webservice/v2.0/defect.csv?query=(Name contains "MyDefect")&fetch=Name,FormattedID,ObjectID&start=1&pagesize=2000
Notice the 'defect.csv' endpoint's name. This targets the 'Defect' endpoint but will return the results in a CSV format. Also notice this query is asking to fetch specifically the fields: Name,FormattedID,ObjectID .
2. Return a CSV file of all users with email address containing "@myorg.com":
https://rally1.rallydev.com/slm/webservice/v2.0/user.csv?query=(EmailAddress contains "@myorg.com")&fetch=UserName,EmailAddress&start=1&pagesize=2000
Also here notice the 'user.csv' endpoint's name which will query the user endpoint and covert the results to a CSV file.