SambaPOS API Integration with NewBook PMS/Booking System

The Execute Script Action does something similar to {CALL:X}, but it does not return values per-say. If you need a value returned, use {CALL:X}.

Here are 2 examples that show how powerful the scripting engine is…

Use Execute Script Action to invoke JScript, which runs SQL script…


Use Execute Script Action to invoke JScript, which runs a query to pull the value out of a Program Setting stored in [ProgramSettingValues] (the value of which happens to be a SQL query), then use JScript to execute that SQL Script, which has the effect of updating a row in the DB [EntityStateLogs] table … for editing Timeclock Punch Data…

3 Likes

If anyone can spare a little time I could really do with a bit of help getting off the ground.
Am sure once I have a starting point I can get to grips with it but am just struggling to get started.
I now have testing account but am not sure how to use these details :confused:
I might have bitten off more than I can chew…

Not sure how to start the script.
Documentations says;

To access our REST API you must authenticate via HTTP username and password,
these will be provided to you along with this document.

I have the username and password but an unsure how to begin.

I converted this to V5 Question since others may benefit from this discussion or may want to provide insight.

2 Likes

Typically its an HTML string you type into browser can you provide more documentation on how their REST setup is working?

NewBook_REST_POS_Integration_Guide.pdf (75.8 KB)

We are missing some key information. We might need to see more documentation on the actual software like when you login to the software there should be some options you need to configure there. Is there a link to any documentation for the actual software?

All I have at the minute is this documentation and a testing username, password and API key.

We might need to see documentation for the actual software. Typically you need to setup some things for REST on that side.

Can you give an example of what type of things?
Just want to avoid showing how little experience I have when contacting them LOL

1 Like

I would just ask to see documentation for the software. You could say it would help in your decision to use it.

PS: Tons of documentation and examples on REST if you google it. One that comes up a lot is Wordpress a very popular online blog that has REST API available for users. You might get ideas by reading how it works there.

I am trying to attempt myself at the minute for what its worth.

Starting with documentation;

POST URL: https://testau.newbookpms.com/rest/auth_test
HTTP Username: As provided
HTTP Password: As provided
JSON Request:
{
"api_key": "your_api_key_here"
}
JSON Response:
{
"success": "You have successfully authenticated to NewBook Test Property"
}

Am just struggling on using POST URL.
From what Ive read online and in documentation (an I may very well have misunderstood) to test my script with auth test i need to ‘post’

{
"api_key": "your_api_key_here"
}

to

https://user:password@testau.newbookpms.com/rest/auth_test

obviously replacing user, password and your_api_key_here
which will give me a response of;

{
"success": "You have successfully authenticated to NewBook Test Property"
}

So to test ‘success’ I would then have

document.write(success);

So starting from the latter I have uploaded test .html to my website;

<!DOCTYPE html>
<html>
<head>
<script type="application/javascript">
???????????
document.write(success);
</script>
</head>
<body>
</body>
</html>

Which is working should give me You have successfully authenticated to NewBook Test Property on the page.

Obviously need to get the ‘POST’ bit.

As the documentation specifies HTTP Username/Password I am starting with https://user:password@testau.newbookpms.com/rest/auth_test for url

I am so so confused, so many different examples and cant even get my head round where the post url should be going into it :frowning:
ajax
cURL
jQuery
My head hurts LOL

Just slow down and read as much as you can. Try to look for discussion forums and typically you might find people showing examples of use.

I am reading all sorts but dont even know if its the right thing for what I need. LOL
Everything I get too either seems to be super basic single page JSON examples or overly complex examples :persevere:

Have done some test coding following the single page basic examples and understand the base JSON part.

Look here for a curl tool to help with playing with REST

http://curl.haxx.se/download.html

Also you might get some decent info here:

https://developer.marklogic.com/try/rest/index

That url is about a specific API but it explains it simple. You might get idea from it. The software your using assumes you know how to use it and doesnt explain it well for a beginner.

Am confused on the use of POST URL in the documentation.
From what I see you either POST/PUT or GET which seems to me think like its one way or the other.
How am I ment to POST ‘api_key’ and get a response?
Presumably Im obviously missing something here.

I think you should focus on getting authenticated first.

Thats what I am doing :slight_smile: well trying
I have to make json request of

{
"api_key": "your_api_key_here"
}

to

POST URL: https://testau.newbookpms.com/rest/auth_test

But if im posting the api key how do i pull the test success value

JSON Response:
{
"success": "You have successfully authenticated to NewBook Test Property"
}
Page

try this

https://testau.newbookpms.com/rest/auth_test?Username=blah&Password=blah

change blah accordingly

Something like?

curl -X POST \
-d '{"api_key":"instances_xxxxxxxxxxxxxxxxxxxxxxx"}' \
'https://testau.newbookpms.com/rest/auth_test?user_name=blah&password=blah'