Developer API

End point

All calls are sent to:

http://bestil-nu.net/rest/api/v1

Users (URL)

Users (also called orderlies) are people who must have access to reserve resources and make canteen purchases.

http://bestil-nu.net/rest/api/v1/users

Update users

<script>

$.ajax({
    type: "PUT",
    url: "https://bestil-nu.net/rest/api/v1/users",
    dataType: "json",
    async: "false",
    contentType: "application/json; charset=utf-8",
    headers: {
    		"accept-version": "v1",
    		"cache-control": "no-cache",
    		"digest": "5552e52b-a921-1013-e8c3-e9c865e4df87"
    },
    data {
       
         "Type":"DELETE",
         "CompanyUid":"5638f4e9-fb5a-4c64-85c5-2adfaaa5dd48",
         "Users":[
          {
         	"InternalId":"PAS2",
         	"Firstname":"Peter",
         	"Lastname":"Andersen",
         	"PhoneLocal":{
            		"Value":"23232323",
            		"Overwrite":"false"
         	},
         	"PhoneMobile":{
            		"Value":"23232323",
            		"Overwrite":"false"
         	},
         	"Email":{
            		"Value":"info@facilitynet.io",
            		"Overwrite":"false"
         	},
         	"Username":{
            		"Value":"myUserName",
            		"Overwrite":"false"
         	},
         	"UsertypeId": "1",
         	"Active":"true",
         	"Department":{
            		"Reference":"DEPT\ASI\PKS",
            		"Name":"Departementet"
         	}
      	},
      	{
         	"InternalId":"PAS2",
         	"Firstname":"Peter",
         	"Lastname":"Andersen",
         	"PhoneLocal":{
            		"Value":"23232323",
            		"Overwrite":"false"
         	},
         	"PhoneMobile":{
            		"Value":"23232323",
            		"Overwrite":"false"
         	},
         	"Email":{
            		"Value":"info@facilitynet.io",
            		"Overwrite":"false"
         	},
         	"Username":{
            		"Value":"myUserName",
            		"Overwrite":"false"
         	},
         	"UsertypeId": "1",
         	"Active":"true",
         	"Department":{
            		"Reference":"DEPT\ASI\PKS",
            		"Name":"Departementet"
         	}
      	}
     
      ]
    },
    success: function(msg) {
        						
          alert( msg );
    },
    error: function (jqXHR, textStatus, errorThrown){
          
          alert('Fejlmeddelelse: '+textStatus );
    }
});

</script>

 

Fetch users

Filtering
usertypeIds=1,2

<script>
$.ajax({
    type: "GET",
    url: https://bestil-nu.net/rest/api/v1/users",
    dataType: "json",
    async: "false",
    contentType: "application/json; charset=utf-8",
    headers: { 
        "accept-version": "v1",
        "cache-control": "no-cache",
        "digest": "5552e52b-a921-1013-e8c3-e9c865e4df87"
    },
    success: function(msg) {
                    
          alert( msg );
    },
    error: function (jqXHR, textStatus, errorThrown){
          
          alert('Fejlmeddelelse: '+textStatus );
    }
});
</script>

Update departments

<script>
$.ajax({
    type: "PUT",
    url: "https://bestil-nu.net/rest/api/v1/departments",
    dataType: "json",
    async: "false",
    contentType: "application/json; charset=utf-8",
    headers: {
        "accept-version": "v1",
        "cache-control": "no-cache",
        "digest": "5552e52b-a921-1013-e8c3-e9c865e4df87",
    },
    data {
       
         "Departments":[
          {
           "Department":{
                "Reference":"DEPT\ASI\PKS",
                "Name":"Departementet"
           }
        },
        {
           "Department":{
                "Reference":"DEPT\ASI\PKS",
                "Name":"Departementet"
           }
        }
     
      ]
    },
    success: function(msg) {
                    
          alert( msg );
    },
    error: function (jqXHR, textStatus, errorThrown){
          
          alert('Fejlmeddelelse: '+textStatus );
    }
});
</script>

 

Departments (URL)

Departments (f.ex. The finance department) is used to assign rights and to filter orders / purchases in reports.

https://bestil-nu.net/rest/api/v1/departments

Fetch departments

<script>
$.ajax({
    type: "GET",
    url: https://bestil-nu.net/rest/api/v1/departments",
    dataType: "json",
    async: "false",
    contentType: "application/json; charset=utf-8",
    headers: {
        "accept-version": "v1",
        "cache-control": "no-cache",
        "digest": "5552e52b-a921-1013-e8c3-e9c865e4df87"
    },
    success: function(msg) {
                    
          alert( msg );
    },
    error: function (jqXHR, textStatus, errorThrown){
          
          alert('Fejlmeddelelse: '+textStatus );
    }
});
&lt;/script&gt;