Helpful tools
JSON to YAML
The site http://www.json2yaml.com is a tool that helps you translate from JSON to YAML and from YAML to JSON. It is very helpful for documenting APIs that support both and for learning how the same structure maps to the other syntax. Here is an example:
DHC
The DHC extension by Restlet for Chrome is a very helpful tool for using APIs.
Given the following JSON payload:
{
"AssetType": "Scope",
"Name": "My New Project",
"Owner": "Member:20",
"Parent": "Scope:0",
"BeginDate": "2/11/2017 5:00:00 PM",
"Description": "This is my new project",
"Workitems": [
{
"AssetType": "Story",
"Name": "My First Story in My New Project",
"Children": [
{
"AssetType": "Test",
"Name": "Test 1",
"Description": "First Story Test Description"
},
{
"AssetType": "Task",
"Name": "Task 1",
"Description": "First Task Task Description"
}
]
},
{
"AssetType": "Story",
"Name": "My Second Story in My New Project",
"Children": [
{
"AssetType": "Test",
"Name": "Test 2",
"Description": "Second Story Test Description"
},
{
"AssetType": "Task",
"Name": "Task 2",
"Description": "Second Story Task Description"
}
]
}
]
}
You can paste it into the DHC tool and run it against the API. It will look like this:
Here is the same payload in YAML syntax:
AssetType: Scope
Name: My New Project
Owner: Member:20
Parent: Scope:0
BeginDate: 2/11/2017 5:00:00 PM
Description: This is my new project
Workitems:
- AssetType: Story
Name: My First Story in My New Project
Children:
- AssetType: Test
Name: Test 1
Description: First Story Test Description
- AssetType: Task
Name: Task 1
Description: First Task Task Description
- AssetType: Story
Name: My Second Story in My New Project
Children:
- AssetType: Test
Name: Test 2
Description: Second Story Test Description
- AssetType: Task
Name: Task 2
Description: Second Story Task Description
And, here is how it will look in DHC. Note that you should change the Content-Type
header to text/yaml
:
Expected result:
Whether using JSON or YAML, you should get a result like this:
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Set-Cookie: .V1.Ticket.VersionOne.Web=HFZlcnNpb25PbmUuV2ViLkF1dGhlbnRpY2F0b3IUAAAABWFkbWluBv8xiX5O1Aj/Pzf0dSjKKxA4ecw6mQ+64T4yfGJPJmKu; path=/; HttpOnly
V1-MemberID: VersionOne.Web/20
X-Powered-By: ASP.NET
Date: Mon, 06 Feb 2017 15:54:34 GMT
Content-Length: 13
"Scope:1112,"
That is, it returns the newly-created Scope OID Token: Scope:1112
.