Introduction to Active Textbook Server APIs: Creating a New User

Introduction to Active Textbook Server APIs: Creating a New User

Hi,

Leonard “Leo” Bush back again on the Datalogics Blog pages. This time to talk about PDF-Alchemist-BIGActive Textbook Server API’s.  Server API documentation can be found on your server at http://your.server.com/apidoc or http://dtl.activetextbook.com/apidoc.  Active Textbook (ATB) API calls can be used to integrate ATB into new or existing systems. Many customers interested in this technology may already have a front end system and will need to connect them to the ATB server. The API calls can be performed in any language that  supports the RESTful web API framework with ‘GET’ and ‘POST’ functionality. Our APIs return the calls in JSON. This blog will cover using one of the APIs with cURL. It is also possible to use a combination of AJAX and Javascript to make the calls initially as some of our customers have done.

Depending on the permission applied to the objects involved, API actions sometimes require an authentication token to be attached.  Such examples are beyond the scope of this blog. It is something you should be aware of.  A good rule of thumb would be that accessing  anything that’s restricted or actions that occur after login will need an authentication token.

For our example today we will use an ATB server API “signup” to create a new user account. We will demonstrate this using cURL from a Mac terminal session.

The “signup” API is a POST operation and accepts the following parameters:

  • Account type
  • User
  • Full Name (required, must be string)
  • Preferred Name
  • Email (required, must be string)
  • Password (required, must be string)
  • Password Confirmation (required, must be string)

To use the API and see it in action open a terminal session on your Mac. Make sure cURL is available to you.  Use “curl –V” ( note the capital V)  to confirm that you able to run the uRUL  commands . To run the signup POST commend with cURL use the following:

curl -X POST –header “Content-Type:application/json” -d ‘{“account_type”:”free”, “user”: {“full_name”:”Joe A. User”, “preferred_name”:”DJ Joe”,
“email”:”DJJoe@sample.com”, “password”:”blogpass”, “password_confirmation”:”blogpass”}}’ http://dtl.activetextbook.com/users.json

If successful the following message is returned.
{“message”:”Account was created successfully but the email has not been confirmed yet”}

To confirm that the operation was successful.  You can login to the server admin account and check the users.  You should see your new user has been created.

If an error is detected and the server is unable to create the account an error message is returned. Examples include: 

403 INVALID_LOGIN: Invalid login credentials
403 EMAIL_NOT_CONFIRMED: Email address for this account has not been confirmed yet
500 INVALID_ACCOUNT: There is something wrong with this account; auth_token is not set

This API can be used to create users on demand or easily used to create a group of accounts.  As shown here, the server will return the calls in JSON.

Please take a look at the other ATB Server APIs available to you.  They cover but are not limited to management functions for Books, Contacts, Devices  and Groups.

Till next time, thanks for reading.

Leo

 

Interested in getting your own Active Textbook server evaluation? Just fill out our evaluation form.

One thought on “Introduction to Active Textbook Server APIs: Creating a New User

Leave a Reply

Your email address will not be published. Required fields are marked *