> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexagon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrating a sequence of curl commands into the REST plugin

> Say that you have an existing snippet that you tested in curl like: to make that work with the rest plugin, choose the operation that matches the HTTP

Say that you have an existing snippet that you tested in curl like:

![Image](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12596420307.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=aaf3d785add233e8a23774bcc462baa3)

to make that work with the rest plugin, choose the operation that matches the HTTP method that you used with curl.

copy the URL. You can use groovy to convert [https://bitbucket.com/projects/DEV/repos/ebs/pull-requests/72/mere?version=0](https://bitbucket.com/projects/DEV/repos/ebs/pull-requests/72/mere?version=0)

to “[https://bitbucket.com/projects/DEV/repos/ebs/pull-requests/” + PR\_ID + “/mere?version=0](https://bitbucket.com/projects/DEV/repos/ebs/pull-requests/72/mere?version=0)”

Now you can pass the pull request ID into the operation.

The headers come from -H (--header) and go into the headers box.

Three double quotes will allow for multiline strings in groovy.

![image-20240325-191753.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12596420313.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=7b353bba5bd9176f738ba156bb768cc6)

```
"Authorization=Bearer " + SECURE_TOKEN_PROPERTY + """
Accept=application/json
Content-Type=application/json"""
```

The -d (--data) goes to the body. If you used a body path, it goes there instead.

Fill in the body media type appropriately (if post/put/patch)

![image-20240325-190938.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12596420304.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=cc2bf1e73b92294b0d0f2bbd2d8cc16a)

The response is available to the workflow at the bottom.

Create workflow variables and reference them here. In this case, we made and used workflow variables ResponseCode and ResponseString.

![image-20240325-191916.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12596420310.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=5213f9b6af83ae8ba41382757f49874c)

If you are expecting to receive json or xml back, you may want to parse it and make decisions on it.

If so, use the [parseJson](https://docs.flexagon.com/flexdeploy-11-2-documentation/flexdeploy-plugin-guides/flexdeploy-xpath-plugin-guide/parsejson.md) or [parseXml](https://docs.flexagon.com/flexdeploy-11-2-documentation/flexdeploy-plugin-guides/flexdeploy-xpath-plugin-guide/parsexml.md) operations to do so.

Again, you would want to create a workflow variable to get the data from the operation that you are on into the workflow, and then use it in the next.
