---
title: "Converting a cURL script into a SIL script"
canonical: "https://support.appfire.com/space/SUPPORT/80878699/Converting%20a%20cURL%20script%20into%20a%20SIL%20script"
format: markdown
---
Converting a cURL script into a SIL script can be time-consuming. Make the conversion easy by following these steps!

## Instructions

For this example, I will be building off this page, “[Running Scripts Via REST](https://appfire.atlassian.net/wiki/spaces/SUPPORT/pages/80878405)”.

1. Import the curl script into Postman by following [these instructions](https://appfire.atlassian.net/wiki/spaces/SUPPORT/pages/80878668).
2. In the right-hand side of Postman, click on the “</>” symbol to see the code converter.
3. Select the language you would like to convert. “Java - Unirest” is the easiest because it parses the headers in a way that is easiest to refactor into SIL code.
4. Create headers based on the Java code. The following copied from the Java code…
  …can be converted into:
5. Now set a string variable using the body. You should be able to paste the string without modification.
6. Lastly, convert the Java post() method to httpPost():

## Final Script

Now that we have all the basic building blocks for a script, put them all together and add some error message handling at the end of the script. If you would like to change up the values passed by the payload, see this documentation on [working with JSON](https://appfire.atlassian.net/wiki/spaces/SUPPORT/pages/80878453).

```
string payload = "{ \n  \"source\": {\n    \"type\": \"FILE\", \"code\": \"createIssue.sil\"\n  },\n    \"args\": [\"EX\", \"\", \"Task\", \"summary goes here\"]\n  }";

HttpRequest request;
request.headers += httpCreateHeader("Accept", "application/json");
request.headers += httpCreateHeader("Content-Type", "application/json");
request.headers += httpCreateHeader("Authorization", "Basic PFVTRVJOQU1FOlBBU1NXT1JEPg==");

string value = httpPost("http://localhost:8080/rest/keplerrominfo/refapp/latest/async-script/runScript", request, payload);

runnerLog(value);

number statusCode = httpGetStatusCode();
if (statusCode >= 200 && statusCode < 300) {
    runnerLog("SUCCESS");
}
else {
    string msg = trim(statusCode) + ":" + httpGetErrorMessage() + ":" + httpGetReasonPhrase();
    runnerLog(msg);
}
```

## Additional Help

Need help implementing this script? Talk to me directly to me by clicking on the bot on bottom of our [anovaapps.com](http://anovaapps.com/) page. 

## Related articles



> Macro (contentbylabel)

> Macro (details)
> 
> | Related issues |  |
> | --- | --- |