---
title: Basic webservices
description: "You may clone all examples from git at this repository: https://github.com/SigmaEstimates/AppScript-Examples.git It is easy to consume webservices directly from Appscript. This enables integrations between Sigma and Cloud based solutions to synchronize and connect data. Example: Send the Sigma budget directly to…"
url: "https://developer.sigmaestimates.com/docs/basic-webservices/"
updated: "2019-05-07"
category: Sample Code
---

# Basic webservices

You may clone all examples from git at this repository: https://github.com/SigmaEstimates/AppScript-Examples.git
It is easy to consume webservices directly from Appscript. This enables integrations between Sigma and Cloud based solutions to synchronize and connect data. Example: Send the Sigma budget directly to a cloud based accounting system, or update a Sigma estimate based on values from a server.
This example show the very basic GET and POST options, but there are more advanced features such as controlling headers, timeouts, and much more.
// GET via SSL
var Url := &#x27;https://google.dk&#x27;;
var Response := WebClient.Get(Url);
if (Response.Success) then
  MessageTaskDlg(&#x27;HTTP Get success&#x27;, Format(&#x27;Address: %s|%s&#x27;, [Url, Response.ContentAsText]), mtInformation, [mbOk])
else
  MessageTaskDlg(&#x27;HTTP Get error&#x27;, Format(&#x27;Address: %s&#x27;#13&#x27;Error code: %d|%s&#x27;, [Url, Response.StatusCode, Response.ContentAsText]), mtError, [mbOk]);

// POST
// First we create a new JSON object with some data to POST
var Content := JSON.NewObject;
Content.Property1 := 100;
Content.Property2 := &quot;Hello&quot;;
Content.List := JSON.NewArray;
Content.List[0] := 6;
Content.List[1] := 12;

Url := &#x27;http://sigmaservice.net/jsontest/&#x27;;
//Post the Content data to our test webservice
Response := WebClient.Post(Url, Content, &#x27;application/json&#x27;);
if (Response.Success) then
begin
  //Parse the returned data from JSON to an AppScript object
  var returnedData = JSON.Parse( Response.ContentAsText );

  //And show the JSON output form the test webservice (which includes our post data)
  MessageTaskDlg(&#x27;HTTP Post success&#x27;, JSONBeautify( returnedData ), mtInformation, [mbOk]);

  //Additionally show how to access a specific data:
  ShowMessage(returnedData.data.Property1);
end else
  MessageTaskDlg(&#x27;HTTP Post error&#x27;, Format(&#x27;Address: %s&#x27;#13&#x27;Error code: %d|%s&#x27;, [Url, Response.StatusCode, Response.ContentAsText]), mtError, [mbOk]);
  
View this file on GitHub
