---
title: "Test Steps - REST"
canonical: "https://docs.getxray.app/space/XRAY/301506828/Test%20Steps%20-%20REST"
format: markdown
---
# Test Step

- To view all the test steps, you need to specify the key of the Test you want to view the test steps.
- To view a specific test step, you need to specify the ID of the test step.
- To create a new test step, you need to send a JSON with the information you want the test step you have.
- To update a test step, you need to send a JSON with the information you want to update.
- To delete a test step, you need to specify the ID of the test step you want to delete.
- To view all the attachments of a test step, you need to specify the ID of the test step you want to view the attachments from.
- To delete an attachment, you need to specify the ID of the attachments you want to delete.


> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Return a json with the test step statuses available in Xray sorted by rank.
> 
> ** **<span style="color: #003366">**Request**</span>
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X GET -u admin:admin </span>[<span style="color: #000000">http://yourserver/rest/raven/1.0/api/settings/teststepstatuses</span>](http://yourserver/rest/raven/1.0/api/settings/teststepstatuses)<span style="color: #000000"> </span>
> 
> ### <span style="color: #003366">**Responses**</span>** **
> 
> 200 OK : **text/plain** : Successful. Return a json.
> 
> 
> ##### **Example Output**
> 
> ```
> [
>  {
>    "id": 1,
>    "rank": 1,
>    "name": "PASS",
>    "description": "The test step has passed."
>    "testStatusId": 1 
>  },
>  {
>    "id": 10,
>    "rank": 10,
>    "name": "SKIP",
>    "description": "The test step has been skipped."
>    "testStatusId": 1 
>  }
>  ...
> ]
> ```
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray for JIRA license is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred getting the test steps.

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Return a json with the test steps of a given test.
> 
> <span style="color: #000000">** **</span><span style="color: #003366">**Request**</span>
> 
> ###### <span style="color: #003366">**PATH **</span><span style="color: #003366">**PARAMETERS**</span>** **
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `testKey` | *String* | - key of the test. |
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X GET -u admin:admin </span>[<span style="color: #000000">http://yourserver/rest/raven/1.0/api/test/TEST-123/step</span>](http://yourserver/rest/raven/1.0/api/test/TEST-123/step)
> 
> ### <span style="color: #003366">**Responses**</span>** **
> 
> 200 OK : **text/plain** : Successful. Return a json.
> 
> ##### **Example Output**
> 
> ```
> [
>    {
>       "id":311,
>       "index":1,
>       "step":{
>          "raw":"Enter the following operation on screen",
>          "rendered":"<p>Enter the following operation on screen</p>"
>       },
>       "data":{
>          "raw":"(1 + 1) * 2",
>          "rendered":"<p>(1 + 1) * 2</p>"
>       },
>       "result":{
>          "raw":"The expected result is *4*",
>          "rendered":"<p>The expected result is <b>4</b></p>"
>       },
>       "attachments":[
>       ]
>    },
>    {
>       "id":312,
>       "index":2,
>       "step":{
>          "raw":"test",
>          "rendered":"<p>test</p>"
>       },
>       "data":{
>          "raw":"test data",
>          "rendered":"<p>test data</p>"
>       },
>       "result":{
>          "raw":"expected data",
>          "rendered":"<p>expected data</p>"
>       },
>       "attachments":[
>          {
>             "id":141,
>             "fileName":"text.txt",
>             "fileSize":"0,0 kB",
>             "created":"Today 3:54 PM",
>             "author":"admin",
>             "fileURL":"http://YOURJIRA/jira/plugins/servlet/raven/attachment/141/text.txt"
>          }
>       ]
>    }
> ]
> ```
> 
> 400 BAD_REQUEST : **text/plain** : Returns the error.
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray for JIRA license is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred getting the test steps.

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Return a json with the test step with the given id.
> 
> <span style="color: #000000">** **</span><span style="color: #003366">**Request**</span><span style="color: #000000">** **</span>
> 
> ###### ** **<span style="color: #003366">**PATH **</span><span style="color: #003366">**PARAMETERS**</span>** **
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `testKey` | *String* | - key of the test. |
> | id | *Integer* | - ID of the test step. |
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X GET -u admin:admin </span>[<span style="color: #000000">http://yourserver/rest/raven/1.0/api/test/TEST-123/step</span>](http://yourserver/rest/raven/1.0/api/test/TEST-123/step)<span style="color: #000000">/311 </span>
> 
> ### <span style="color: #003366">**Responses**</span>** **
> 
> 200 OK : **text/plain** : Successful. Return a json.
> 
> ##### **Example Output**
> 
> ```
> {
>    "id":311,
>    "index":1,
>    "step":{
>       "raw":"Enter the following operation on screen",
>       "rendered":"<p>Enter the following operation on screen</p>"
>    },
>    "data":{
>       "raw":"(1 + 1) * 2",
>       "rendered":"<p>(1 + 1) * 2</p>"
>    },
>    "result":{
>       "raw":"The expected result is *4*",
>       "rendered":"<p>The expected result is <b>4</b></p>"
>    },
>    "attachments":[
>    ]
> }
> ```
> 
> 400 BAD_REQUEST : **text/plain** : Returns the error.
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray for JIRA license is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred getting the test step.

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Create a new test step.
> 
> <span style="color: #000000">** **</span><span style="color: #003366">**Request**</span><span style="color: #000000">** **</span>
> 
> ###### ** **<span style="color: #003366">**PATH **</span><span style="color: #003366">**PARAMETERS**</span>
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `testKey` | *String* | - key of the test |
> 
> ##### **Example Input**
> 
> ```
> {
>    "step":"example step",
>    "data":"example data",
>    "result":"example result",
>    "attachments":[
>       {
>          "data":"gsddfgdsfg...(base64) ",
>          "filename":"example1.txt",
>          "contentType":"plain/text"
>       },
>       {
>          "data":"gsddfgdsfg...(base64) ",
>          "filename":"example2.txt",
>          "contentType":"plain/text"
>       }
>    ]
> }
> ```
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X PUT -u admin:admin --data @example.json </span>[<span style="color: #000000">http://yourserver</span>](http://yourserver)<span style="color: #000000">/</span><span style="color: #000000">rest/raven/1.0/api/test/TEST-123/step</span>
> 
> ### <span style="color: #003366">**Responses**</span>
> 
> 200 OK : **text/plain** : Successful.
> 
> 400 BAD_REQUEST : **text/plain** : Returns the error.
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray for JIRA license is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred creating the test step.

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Update a specific test step.
> 
> <span style="color: #000000">** **</span><span style="color: #003366">**Request**</span><span style="color: #000000">** **</span>
> 
> ###### ** **<span style="color: #003366">**PATH **</span><span style="color: #003366">**PARAMETERS**</span>
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `testKey` | *String* | - key of the test. |
> | id | *Integer* | *- *ID of the test step. |
> 
> ##### **Example Input**
> 
> ```
> {
> 	"step": "example step",
> 	"data": "example data",
> 	"result": "example result",
> 	"attachments": {
> 		"add": [{
> 			"data": "gsddfgdsfg...(base64) ",
> 			"filename": "example1.txt",
> 			"contentType": "plain/text"
> 		}, {
> 			"data": "gsddfgdsfg...(base64) ",
> 			"filename": "example2.txt",
> 			"contentType": "plain/text"
> 		}],
> 		"remove": [
> 			141,
> 			105
> 		]
> 	}
> }
> ```
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X POST -u admin:admin --data @example.json </span>[<span style="color: #000000">http://yourserver</span>](http://yourserver)<span style="color: #000000">/</span><span style="color: #000000">rest/raven/1.0/api/test/TEST-123/step/1 </span>
> 
> <span style="color: #003366">**Responses**</span><span style="color: #000000">** **</span>
> 
> 200 OK : **text/plain** : Successful.
> 
> 400 BAD_REQUEST : **text/plain** : Returns the error.
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray for JIRA license is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred updating the test step.

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Remove a test step from a test.
> 
> <span style="color: #000000">** **</span><span style="color: #003366">**Request**</span><span style="color: #000000">** **</span>
> 
> ###### ** **<span style="color: #003366">**PATH **</span><span style="color: #003366">**PARAMETERS**</span>** **
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `testKey` | *String* | - key of the test. |
> | id | *Integer* | *- *ID of the test step. |
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X DELETE -u admin:admin </span>[<span style="color: #000000">http://yourserver</span>](http://yourserver)<span style="color: #000000">/</span><span style="color: #000000">rest/raven/1.0/api/test/TEST-123/step/1 </span>
> 
> ###### <span style="color: #003366">**Responses**</span>** **
> 
> 200 OK : **text/plain** : Successful.
> 
> 400 BAD_REQUEST : **text/plain** : Returns the error.
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray for JIRA license is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred deleting the test step.

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Return a json with all the test step attachments.
> 
> <span style="color: #000000">** **</span><span style="color: #003366">**Request**</span><span style="color: #000000">** **</span>
> 
> ###### ** **<span style="color: #003366">**PATH **</span><span style="color: #003366">**PARAMETERS**</span>
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `testKey` | *String* | - key of the test. |
> | id | *Integer* | - ID of the test step. |
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X GET -u admin:admin </span>[<span style="color: #000000">http://yourserver/rest/raven/1.0/api/test/TEST-123/step</span>](http://yourserver/rest/raven/1.0/api/test/TEST-123/step)<span style="color: #000000">/1/attachment</span>
> 
> ### <span style="color: #003366">**Responses**</span>** **
> 
> 200 OK : **text/plain** : Successful. Return a json.
> 
> ##### **Example Output**
> 
> ```
> [
>    {
>       "id":141,
>       "fileName":"text.txt",
>       "fileSize":"8,0 kB",
>       "created":"Today 3:54 PM",
>       "author":"admin",
>       "fileURL":"http://YOURJIRA/jira/plugins/servlet/raven/attachment/141/TEST1.txt"
>    },
>    {
>       "id":147,
>       "fileName":"text.txt",
>       "fileSize":"3,0 kB",
>       "created":"Today 3:54 PM",
>       "author":"admin",
>       "fileURL":"http://YOURJIRA/jira/plugins/servlet/raven/attachment/147/TEST2.txt"
>    }
> ]
> ```
> 
> 400 BAD_REQUEST : **text/plain** : Returns the error.
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray for JIRA license is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred getting the test step attachments.

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Remove an attachment from a test step.
> 
> <span style="color: #000000">** **</span><span style="color: #003366">**Request**</span><span style="color: #000000">** **</span>
> 
> ###### ** **<span style="color: #003366">**PATH **</span><span style="color: #003366">**PARAMETERS**</span>
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `testKey` | *String* | - key of the test. |
> | id | *Integer* | - ID of the test step. |
> | attachmentID | *Integer* | - ID of the attachment |
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X DELETE -u admin:admin </span>[<span style="color: #000000">http://yourserver</span>](http://yourserver)<span style="color: #000000">/</span><span style="color: #000000">rest/raven/1.0/api/test/TEST-123/step/1/attachment/2 </span>
> 
> ### <span style="color: #003366">**Responses**</span>** **
> 
> 200 OK : **text/plain** : Successful.
> 
> 400 BAD_REQUEST : **text/plain** : Returns the error.
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray for JIRA license is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred removing the test step attachment.