DMcCabe
12 years agoContributor
Passing Response field into URI path for next test
I am doing a post to a REST webservice to create a subscriber resource. When the resource is successfully created I get
{
"_links": {
"curie": {
"href": "/rels/{rel}",
"name": "rels",
"templated": true
},
"self": {
"href": "/subscribers/13"
},
"rels:add-site": {
"href": "/subscribers/13/sites"
},
"rels:delete-subscriber": {
"href": "/subscribers/13"
},
"rels:list-sites": {
"href": "/subscribers/13/sites"
},
"rels:update-subscriber": {
"href": "/subscribers/13"
},
"up": {
"href": "/subscribers"
}
},
"email": "p.smith@xyz.com",
"firstName": "Patrick",
"lastName": "Smith",
"organization": null,
"phone": null,
"salesForceId": null,
"url": "www.xyz.com"
}
I want to say delete that subscriber then. To do so I parse out the href value out of the following:
"rels:delete-subscriber": {
"href": "/subscribers/13"
and add /subscribers/13 to the base url and do a delete http request.
How can I add /subscribers/13 to the base url of the next test case?
{
"_links": {
"curie": {
"href": "/rels/{rel}",
"name": "rels",
"templated": true
},
"self": {
"href": "/subscribers/13"
},
"rels:add-site": {
"href": "/subscribers/13/sites"
},
"rels:delete-subscriber": {
"href": "/subscribers/13"
},
"rels:list-sites": {
"href": "/subscribers/13/sites"
},
"rels:update-subscriber": {
"href": "/subscribers/13"
},
"up": {
"href": "/subscribers"
}
},
"email": "p.smith@xyz.com",
"firstName": "Patrick",
"lastName": "Smith",
"organization": null,
"phone": null,
"salesForceId": null,
"url": "www.xyz.com"
}
I want to say delete that subscriber then. To do so I parse out the href value out of the following:
"rels:delete-subscriber": {
"href": "/subscribers/13"
and add /subscribers/13 to the base url and do a delete http request.
How can I add /subscribers/13 to the base url of the next test case?