Loading...

OLD API Endpoint: Workplace

In September 2018 Wisenet released a beta version of a new API named Wisenet API. This became live in December 2018. The Wisenet API is a complete rewrite and is designed to replace the now named OLD API. While we will be keeping the OLD API active for at least a year, it will no longer be updated.

Go to Wisenet API Docs 

The Wisenet Workplace Endpoint allows your applications to get information about workplaces, add new workplaces, update their details.

Dropdown Lists

  • ANZSIC
  • WorkplaceClassification
  • IndustrySize

Please see for details:
API Developer’s Resources Dropdown Lists

Workplace Properties

If using xml serialization please order the properties alphabetically.

In the field list below for string fields datatype, maxlength and dropdown reference is specified.
Omitting fields in PUT statements:

Standard behavior: the StudentAdmin database will keep existing value.

The following are mandatory for a PUT / POST request:

There is no such fields but it is recommended that you specify at least

  • Description

The following are optional for a PUT / POST request:

  • ABN (maxlength:255)
  • ANSZIC (see dropdowns: ANSZIC)
  • Classification (see dropdowns: WorkplaceClassification)
  • Code (maxlength:20)
  • CorporationNumber (maxlength:255)
  • Description (maxlength:150)
  • Email (maxlength:50)
  • Fax (maxlength:20)
  • HeadOfficeWorkplace (the same structure as Workplace with the mandatory field WorkplaceID)
  • IndustrySize (see dropdowns: IndustrySize )
  • IsSchool (bit)
  • LegalName (maxlength:100)
  • Notes (maxlength:100)
  • PostalAddress (See Address section below)
  • StreetAddress (See Address section below)
  • SyncToSugar (bit)
  • Telephone (maxlength:15)
  • Website (maxlength:500)

The following are only returned on a GET request:

  • Link
  • WorkplaceId

Address Section Properties

Address properties (i.e. PostalAddress, StreetAddress) are in their turn structures with inner list of properties

The following properties are optional for a PUT / POST request:

  • AddressLine1 (maxlength:50)
  • AddressLine2 (maxlength:50)
  • AddressLine3 (maxlength:50)
  • Country (c) (see dropdowns: Country)
  • PostCode (maxlength:20)
  • State (see dropdowns: State)

Please note that for workplaces there is not split to StreetName, UnitDetails etc.

Here we just use AddressLine1.

List All Workplaces

GET /workplaces/

Returns the list of all workplaces.

Sample request:

 curl -X GET \
   -H "Accept: application/vnd.mywisenet.api.v1+xml" \
   https://tst-api.wisenet.co/workplaces/

Sample response:

<WorkplaceSet xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<SetCount>1</SetCount>
	<Workplaces>
		<Workplace>
			<ABN>14141414</ABN>
			<ANSZIC>
				<Code>03</Code>
				<Description>Forestry and Logging (03)</Description>
			</ANSZIC>
			<Classification>
				<Code>01</Code>
				<Description>Restaurant</Description>
			</Classification>
			<Code>Code</Code>
			<CorporationNumber>42544254</CorporationNumber>
			<Description>Acme Pty Ltd - Melbourne Office</Description>
			<Email>albert@park.com.au</Email>
			<Fax>03 8888 8888</Fax>
			<IndustrySize/>
			<IsSchool>false</IsSchool>
			<LegalName>Acme Pty Ltd</LegalName>
			<Link><Href>workplaces/workplace/1</Href><Rel>self</Rel><Title>1: Code -- Albert Village Hotel - Head Office</Title></Link>
			<Notes>Workplace Comments</Notes>
			<PostalAddress>
				<AddressLine1>23 Harcourt Street</AddressLine1>
				<AddressLine2>Middle section</AddressLine2>
				<AddressLine3>Albert Park</AddressLine3>
				<Country><Code/></Country>
				<PostCode>3252</PostCode>
				<State><Code/><Description>Vic</Description></State>
			</PostalAddress>
			<StreetAddress>
				<AddressLine1>23 Harcourt Street</AddressLine1>
				<AddressLine2>Middle section</AddressLine2>
				<AddressLine3>Albert Park</AddressLine3>
				<Country><Code/></Country>
				<PostCode>3252</PostCode>
				<State><Code/><Description>Vic</Description></State>
			</StreetAddress>
			<SyncToSugar>false</SyncToSugar>
			<Telephone>03 5555 5555</Telephone>
			<WebSite>www.park.com.au</WebSite>
			<WorkplaceId>1</WorkplaceID>
		</Workplace>
	</Workplaces>
</WorkplaceSet>

C# Code Sample

public static void GetSample()
{
    const string url = "https://tst-api.wisenet.co/workplacess/";

    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.Accept = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "GET";
    request.UserAgent = "C# Sample Client";

    try
    {
        // Get response  
        using (var response = request.GetResponse() as HttpWebResponse)
        {
            // Get the response stream  
            using (var responseReader = new StreamReader(response.GetResponseStream()))
            {
                string responseBody = responseReader.ReadToEnd();

                // Console application output  
                Console.WriteLine(responseBody);
            }
        }
    }
    catch (WebException ex)
    {
        Console.WriteLine("Error: {0}", ex.Message);
    }
}

List modified Workplaces

GET /workplaces/

Set the If-Modified-Since header in the HTTP request. The date must be in UTC format.

Returns the list of workplaces created or modified since the specified date.

The Workplaces endpoint will filter on the <LastUpdated> field on each workplace. This field is updated to the current UTC date whenever a workplae is created or edited.

Sample request:

 curl -GET \
   -H "Accept: application/vnd.mywisenet.api.v1+xml" \
   -H "If-Modified-Since: Fri, 8 Jul 2011 1:43:31 GMT" \
   https://tst-api.wisenet.co/workplacess/

Response format would be the same as for the List All workplaces command.

Note: We would recommend that all calls to list workplaces from the API use this If-Modified-Since header.

C# Code Sample

private static void GetIfModifiedSinceSample()
{
    const string url = "https://tst-api.wisenet.co/workplaces/";

    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.Accept = "application/vnd.mywisenet.api.v1+xml";
    request.IfModifiedSince = DateTime.Now.AddDays(-1);
    request.Method = "GET";
    request.UserAgent = "C# Sample Client";

    try
    {
        // Get response  
        using (var response = request.GetResponse() as HttpWebResponse)
        {
            // Get the response stream  
            using (var responseReader = new StreamReader(response.GetResponseStream()))
            {
                string responseBody = responseReader.ReadToEnd();

                // Console application output  
                Console.WriteLine(responseBody);
            }
        }
    }
    catch (WebException wex)
    {
        Console.WriteLine("Error: {0}", wex.Message);
    }
}

Filtered search

List Workplaces by page

GET /workplaces/?skip={skip}&take={take}

Skips {skip} items in workplace list, then returns {take} items.

Sample request:

 curl -X GET \
   -H "Accept: application/vnd.mywisenet.api.v1+xml" \
   https://tst-api.wisenet.co/workplaces/?skip=100&take=20

Response format would be the same as for the List All workplaces command.

List Workplaces with code

GET /workplaces/?code={code}

Searches workplaces by code

Sample request:

 curl -X GET \
   -H "Accept: application/vnd.mywisenet.api.v1+xml" \
   https://tst-api.wisenet.co/workplaces/?code=MAC

Response format would be the same as for the List All workplaces command.

Read Workplace

GET /workplaces/workplace/{id}

Returns extended information about the workplace with the specified {id}.

Sample request:

curl -X GET \
  -H "Accept: application/vnd.mywisenet.api.v1+xml" \
  https://tst-api.wisenet.co/workplaces/workplace/1

Sample response 1:

    <Workplace xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<ABN>14141414</ABN>
	<ANSZIC>
		<Code>03</Code>
		<Description>Forestry and Logging (03)</Description>
	</ANSZIC>
	<Classification>
		<Code>01</Code>
		<Description>Restaurant</Description>
	</Classification>
	<Code>Code</Code>
	<CorporationNumber>42544254</CorporationNumber>
	<Description>Acme Pty Ltd - Melbourne Office</Description>
	<Email>albert@park.com.au</Email>
	<Fax>03 8888 8888</Fax>
	<IndustrySize/>
	<IsSchool>false</IsSchool>
	<LegalName>Acme Pty Ltd</LegalName>
	<Link><Href>workplaces/workplace/1</Href><Rel>self</Rel><Title>1: Code -- Albert Village Hotel - Head Office</Title></Link>
	<Notes>Workplace Comments</Notes>
	<PostalAddress>
		<AddressLine1>23 Harcourt Street</AddressLine1>
		<AddressLine2>Middle section</AddressLine2>
		<AddressLine3>Albert Park</AddressLine3>
		<Country><Code/></Country>
		<PostCode>3252</PostCode>
		<State><Code/><Description>Vic</Description></State>
	</PostalAddress>
	<StreetAddress>
		<AddressLine1>23 Harcourt Street</AddressLine1>
		<AddressLine2>Middle section</AddressLine2>
		<AddressLine3>Albert Park</AddressLine3>
		<Country><Code/></Country>
		<PostCode>3252</PostCode>
		<State><Code/><Description>Vic</Description></State>
	</StreetAddress>
	<SyncToSugar>false</SyncToSugar>
	<Telephone>03 5555 5555</Telephone>
	<WebSite>www.park.com.au</WebSite>
	<WorkplaceId>1</WorkplaceID>
    </Workplace>

Sample Response 2: incorrect ID would return 404 HTTP code

    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
        The Workplace with ID '2' cannot be found.
    </string>

C# Code Sample

private static void ReadSample()
{
    const string url = "https://tst-api.wisenet.co/workplaces/workplace/1";

    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.Accept = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "GET";
    request.UserAgent = "C# Sample Client";

    try
    {
        // Get response  
        using (var response = request.GetResponse() as HttpWebResponse)
        {
            // Get the response stream  
            using (var responseReader = new StreamReader(response.GetResponseStream()))
            {
                string responseBody = responseReader.ReadToEnd();

                // Console application output  
                Console.WriteLine(responseBody);
            }
        }
    }
    catch (WebException ex)
    {
        Console.WriteLine("Error: {0}", ex.Message);
    }
}

Update Workplace

PUT /workplaces/workplace/{id}

Updates the workplace record with the specified {id}.

Notes: The GET message contains content that cannot just be sent back in the POST / PUT eg. <WorkplaceSet>.

POST / PUT can only be made individually per record and not in batch, so the request body would start with “<Workplace”, please see for example below.

If you like to receive the updated workplace back please use reload=true param

PUT /workplaces/workplace/{id}?reload=true

Sample request:

 curl -X PUT \
   -H "Content-Type: application/vnd.mywisenet.api.v1+xml" \
   -v \
   -d @workplace1.xml \
   https://tst-api.wisenet.co/workplaces/workplace/1

workplace1.xml:

<Workplace xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <Description>Company New Name</Description>
</Workplace>

Sample response:

< HTTP/1.1 200 OK
< Date: Mon, 04 Jul 2011 23:34:04 GMT
< Content-Length: 0

C# Code Sample

private static void UpdateSample()
{
    const string url = "https://tst-api.wisenet.co/workplaces/workplace/1";

    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.ContentType = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "PUT";
    request.UserAgent = "C# Sample Client";

    byte[] byteData = File.ReadAllBytes("workplace1.xml");   

    // Set the content length in the request headers  
    request.ContentLength = byteData.Length;

    // Write data  
    using (Stream postStream = request.GetRequestStream())
    {
        postStream.Write(byteData, 0, byteData.Length);
    } 

    try
    {
        // Get response  
        using (var response = request.GetResponse() as HttpWebResponse)
        {
            // Get the response stream  
            using (var responseReader = new StreamReader(response.GetResponseStream()))
            {
                string responseBody = responseReader.ReadToEnd();

                // Console application output  
                Console.WriteLine(responseBody);
            }
        }
    }
    catch (WebException wex)
    {
        Console.WriteLine("Error: {0}", wex.Message);
    }
}

PHP Code Sample

 function updateWorkplace_curl(){

    $credentials = "username:password"; 
    $URL = "https://tst-api.wisenet.co/workplaces/workplace/1"; //you can add ?reload=true if you wish to get updated workplace info

    $workplaceUpdateById_XML = '<Workplace xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Description>Company New Name</Description>
</Workplace>';

    /**
    * Create XML for updating the workplace information given in XML
    */

    /** use a max of 256KB of RAM before going to disk */  
    $putData = fopen('php://temp/maxmemory:256000', 'w+');  
    if (!$putData) {  
        die('could not open temp memory data');  
    }  
    fwrite($putData, $workplaceUpdateById_XML);  
    fseek($putData, 0);  

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $URL);
    curl_setopt($ch, CURLOPT_PUT, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/vnd.mywisenet.api.v1+xml', 'User-Agent: PHP Sample client') );
    curl_setopt($ch, CURLOPT_INFILE, $putData);  
    curl_setopt($ch, CURLOPT_INFILESIZE, strlen($workplaceUpdateById_XML)); 

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_USERPWD, $credentials);

    $result = curl_exec($ch);
    $info = curl_getinfo($ch);
    fclose($putData);
    curl_close($ch);
    if($info['http_code']==204){
        return true;
    }else if($info['http_code']==200){
        return $result;
    }else{
        return false;
    }

}

Another PHP Code Sample

 function updateWorkplace_curl(){

    $credentials = "username:password"; 
    $URL = "https://tst-api.wisenet.co/workplaces/workplace/1";//?reload=true

    $workplaceUpdateById_XML = '<Workplace xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Description>Company New Name</Description>
</Workplace>';

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $URL);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/vnd.mywisenet.api.v1+xml', 'User-Agent: PHP Sample client' ,'Content-Length: ' . strlen($workplaceUpdateById_XML)));
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); 
    curl_setopt($ch, CURLOPT_POSTFIELDS,$workplaceUpdateById_XML);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_USERPWD, $credentials);

    $result = curl_exec($ch);
    $info = curl_getinfo($ch);
    curl_close($ch);
    if($info['http_code']==204){
        return true;
    }else if($info['http_code']==200){
        return $result;
    }else{
        return false;
    }

}

Add Workplace

POST /workplaces/

Inserts a new workplace record.

Notes: The GET message contains content that cannot just be sent back in the POST / PUT eg. <WorkplaceSet>.

POST / PUT can only be made individually per record and not in batch, so the request body would start with “<Workplace”, please see for example below.
Restriction: WorkplaceId must be empty.

The Location header on the HTTP response will indicate the URI of the newly created Workplace resource.

If you like to receive newly created workplace back please use reload=true param

POST /workplaces/?reload=true

Sample request:

curl -X POST \
  -H "Content-Type: application/vnd.mywisenet.api.v1+xml" \
  -d @NewWorkplace.xml \
  -v \
  https://tst-api.wisenet.co/workplaces/

NewWorkplace.xml:

<Workplace xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <Description>TestWorkplaceName</Description>
</Workplace>

Sample response:

< HTTP/1.1 200 OK
< Date: Mon, 04 Jul 2011 23:34:04 GMT
< Content-Length: 0
< Location: https://tst-api.wisenet.co/workplaces/workplace/2

C# Code Sample

private static void AddSample()
{
    const string url = "https://tst-api.wisenet.co/workplaces/";

    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.ContentType = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "POST";
    request.UserAgent = "C# Sample Client";

    byte[] byteData = File.ReadAllBytes("NewWorkplace.xml");

    // Set the content length in the request headers  
    request.ContentLength = byteData.Length;

    // Write data  
    using (Stream postStream = request.GetRequestStream())
    {
        postStream.Write(byteData, 0, byteData.Length);
    }

    try
    {
        // Get response
        using (var response = request.GetResponse() as HttpWebResponse)
        {
            // Get the response stream
            using (var responseReader = new StreamReader(response.GetResponseStream()))
            {
                string responseBody = responseReader.ReadToEnd();

                // Console application output
                Console.WriteLine("StatusCode: {0}; Response body: {1}", response.StatusCode, responseBody);
            }
        }
    }
    catch (WebException ex)
    {
        Console.WriteLine("Error: {0}", ex.Message);
    }
}

Sample request to post a JSON:

curl -X POST \
  -H "Content-Type: application/json" \
  -d @NewWorkplace.json \
  -v \
  https://tst-api.wisenet.co/workplaces/

NewWorkplace.json:

{
"Description" : "Company Name Ltd"
}

List all Endpoints

Was this Resource helpful?