<RestClientRequest>
<option name="httpMethod" value="POST" />
<option name="urlBase" value="https://aWebsite.net" />
<option name="urlPath" value="/atoken" />
<option name="headers">
<list>
<KeyValuePair>
<option name="key" value="Content-Type" />
<option name="value" value="application/x-www-form-urlencoded" />
</KeyValuePair>
<KeyValuePair>
<option name="key" value="Cache-Control" />
<option name="value" value="no-cache" />
</KeyValuePair>
</list>
</option>
<option name="parameters">
<list>
<KeyValuePair>
<option name="key" value="username" />
<option name="value" value="me" />
</KeyValuePair>
<KeyValuePair>
<option name="key" value="password" />
<option name="value" value="verySecret" />
</KeyValuePair>
<KeyValuePair>
<option name="key" value="grant_type" />
<option name="value" value="password" />
</KeyValuePair>
</list>
</option>
<option name="parametersEnabled" value="true" />
<option name="haveTextToSend" value="false" />
<option name="haveFileToSend" value="false" />
<option name="isFileUpload" value="false" />
<option name="textToSend" value="" />
<option name="filesToSend" value="" />
</RestClientRequest>
api = 'https://aWebsite.net/aToken';
body.username = 'me';
body.password = 'verySecret';
body.grant_type = 'password';
options = weboptions('MediaType', 'application/json' ,'RequestMethod','post','ArrayFormat','json');
respon = webwrite(api, body, options);