Database Builder with Postback URL
Constructing your DBB Postback doesn’t require any coding – just copying and pasting based on the instructions below.
The key benefit with DBB Postback is directly updating a validation database stored on codeREADr’s servers in real time. In this way, you don’t have export scan records from codeREADr and create a new, updated CSV file to later upload to that database.
A validation database is a table of barcode values and associated data stored on codeREADr’s servers for use with your validation Service types. After each scan, the associated data is presented as a ‘response’ to the app-user if the barcode value exists in that database.
Normally if the barcode value doesn’t exist in the database the app-user will get an Invalid response after scanning that value. However, with DBB Postback you can enable your app users to add that value to the database along with associated data (text, photos, etc.) and allow them to edit data associated with values already existing in the database.
In all cases scan records are also saved on our server and from the Scans page can be filtered, shared, exported or inserted into third party databases.
DBB Postback only works when the app-user has Internet connectivity. Also, use it only when you need to add or edit the data associated with the scanned barcode value. If you simply want to add values to a validation database then you should use Pattern Validation option which can work online or offline.
Primary Use Cases
- One Service to build a database for a different Service: DBB Scan Records are posted to the DBB Destination Database by app users authorized to scan for Service A. Those app users build the database to be used by Service B, a totally separate Service, generally without the ability to add or edit values. For example, Service A may provision IDs, vouchers or assets to the destination database while Service B is meant to simply validate if the value is in the database and optionally check for duplicate scans for access control, attendance, voucher redemption, asset tagging, etc.
- One Service to build and continuously update the same database: With the add + update use case, app users can post DBB Scan Records to the DBB Destination Database and can be continuously updated the DBB Response after any scan as/if necessary. Typical applications include asset tracking with status updates (location, condition, disposition); student/member/employee record updates; and inventory management with location and quantity updates.
Definition of Options
- DBB Scan Record: This is the DBB Value (i.e. the barcode value scanned or entered via manual entry or lookup) along with the DBB Response (i.e. the result stored when the app user answers Questions you prompt them with). Depending on the construction of your URL those answers either replace existing data in the DBB Destination Database or are added if not already there.
- DBB Destination Database: This is the validation database into which the DBB Values and the DBB Responses are stored. It can be a validation database associated with the Service the app user is scanning for or it can be a database associated with a totally different Service. The latter option is valuable if, for example, one service is used to provision values to a database of IDs, assets, etc., but a different service is used to check if those values are in the database before the disposition process.
Step 1: Create a DBB Destination Database and get the database ID
Step 2: Create a validation service
Step 3: Add Your Questions:
App-user prompts (‘Questions’) to capture form field entries, multiple choice answers, photos and other data after each scan are created in the standard way (see here about creating a question). However, when you choose when the questions will appear to the app-user you MUST have them appear AFTER submitting any scan, or a Valid scan or an Invalid scan.
Step 4: Get Your API Key:
Your account’s API key is needed for the Postback to work. [Note: you need a paid account to have an API Key.]
Step 5: Create your Postback URL:
This is where you use the database ID and API Key. You replace ‘DB_ID’ with the destination database ID and replace ‘API_KEY’ with your Api Key.
Edit this URL (copy & paste into a text editor, e.g. Word, Notepad, etc. with no spaces):
- Add + Edit (adds values and answers if not already in the destination database and allows the editing of prior answers): https://api.codereadr.com/pb/dbb-postback.php?database_id=DB_ID&api_key=API_KEY&require_answer=false
- Edit Only (only allows the editing of prior answers already in the destination database): https://api.codereadr.com/pb/dbb-postback.php?database_id=DB_ID&api_key=API_KEY&require_status=valid
Important: The most common mistake is including a space in the URL or missing part of the text (a ‘variable’) which you need to append to the URL. Carefully check your URL in a text editor like Notepad or similar program if you have any trouble.
The optional variable “&require_answer=false” will give an Invalid response to the app user but will add the DBB Scan Record to the DBB Destination database once submitted. The variable &require_answer=true will give the app user a Valid response since the value needs to already be in the DBB Destination database if you use this variable. The app user will be presented with the existing associated data and can edit that data by entering new data, provided however that they answer at least one of the Questions.
Require Valid Response:
This optional variable “&require_status=valid” will only add DBB Scan Record if the scanned value is already in the DBB Destination Database. If you use this variable, app users will not be able to add new values to a DBB Destination Database
Labeling Response Text:
This optional variable “&transfer_label=YOUR_LABEL_TEXT” presents your original response text (i.e. column 2 of your validation database) for each value to the app user when that value is scanned. For example, this will always show the description of the asset after a scan along with DBB Responses.
Step 6: Insert your Postback URL and Alter Response Value
On the Advanced tab, you need to insert your Post back URL into the Post back section. Use the default options as checked.
To have the data formatted as structured data, you also need to check ‘Alter Response Value’ and copy and paste the following:
- Alter Response Pattern: ^([\s\S]*)$
- Alter Response Replacement: copy and paste from this text file DB Builder Postback HTML.
Important: This Alter Response Replacement script works for older versions of Android OS (4.1 and higher) but you need iOS 10.0 or higher even though the app supports lower iOS versions.
There are three optional variables within that document:
showLabels = true (or false)
defaultResponse = “Custom message for empty responses go here.”
defaultOrder = [enter question IDs separated by a comma]
Step 7: Scan Records
On the Scans page you can filter, export, share and insert scan records into your own or third party databases based on an export template. Look here for information on scans.
Note: You can use the standard Export Template feature, but to parse the structured response you will need these instructions.