1.0.0 • Published 1 year ago

@blauhutpartner/prorest-js-client v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

prorest-js-client

A JavaScript client for ProREST, a RESTful web interface for the ERP System ProCoS

How to install

Manually download and reference the ProREST.js file or use your preferred package manager (recommended, e. g. npm or Yarn).

Usage example

yarn add prorest-js-client
<!DOCTYPE html>
<html>
	<head>
		...
	</head>
	<body>
		...
		<script src="node_modules/ProREST.js"></script>
	</body>
</html>
// Create a new instance
var proRest = new ProRest("https://<YourServer>/api");

// Login by username & password to obtain an access token
proRest.Login("<Username>", "<Password>, null, function(response)
{
	// Login was successful
	// response.Token contains the obtained token
},
function(xhr)
{
	// Login was NOT successful
});

// Or directly use a known access token
proRest.SetToken("<YourToken>");

// Call a stored procedure (with parameters)
var parameters = [];
parameters.push(proRest.CreateStoredProcedureRequestParameter("@Mitarbeiter", "<TheParamValue>"));
proRest.StoredProcedure("procos.ExampleGetDataByMitarbeiter", parameters,
function(response)
{
	// response provides the resultset(s)
},
function(xhr)
{
	// Something went wrong
});
1.0.0

1 year ago