Integrating Nervoscan REST (Redirect Flow)
This guide shows how to integrate a simple, redirect-based scan flow into your app. A user taps a button, your app creates a scan job, then redirects to Nervoscan’s hosted scanner in the browser. You can later fetch the results by job ID.
Base URL: https://backend.nervoscan.com (see full endpoint details in the REST API doc).
Prerequisites
- Credentials (username and password) provisioned by Nervotec
- Ability to make HTTPS requests from your app/server
- Store a reference to the created
JOB_IDwith your user/session to fetch results later
End-to-End Flow
- Authenticate
- Create a Job and Get the Scan URL
- Redirect the User to the Scan URL
- (Optional) Check Job Status
- Fetch Final Results (Later)
Android Example (Conceptual)
Button tap handler
- Call
/clientlogin→ receiveaccess_token - Call
/clientgeturlwithAuthorization: Bearer <access_token>→ receiveurl - Parse
api_keyas<JOB_ID>fromurland persist it - Launch the browser using Custom Tabs or an ACTION_VIEW intent to open
url
Implementation tips
- Use
CustomTabsIntentorIntent(Intent.ACTION_VIEW, Uri.parse(url)) - Persist
JOB_ID(e.g., in local DB or backend mapped to the authenticated user) - Optionally poll
/checkif your UX needs to know when the scan is done
iOS Example (Conceptual)
Button tap handler
- Call
/clientlogin→ receiveaccess_token - Call
/clientgeturlwithAuthorization: Bearer <access_token>→ receiveurl - Parse
api_keyas<JOB_ID>fromurland persist it - Open
SFSafariViewControlleror hand off to the system browser with theurl
Implementation tips
- Prefer
SFSafariViewControllerfor an in‑app browser experience - Persist
JOB_IDfor later result retrieval via/getcustomerinfo
Web App Example (Conceptual)
On scan button click
- Authenticate → get
access_token - Create job → get
url(containsapi_key) - Store
JOB_IDin your backend against the user - Redirect the browser:
window.location.href = url
Optional: use /check to reflect status in your UI after the user returns, then fetch final results via /getcustomerinfo when ready.
What to Store
JOB_ID: Required to fetch results later- A link from your user/session to the
JOB_ID - Minimal metadata you need to reconcile scans to business records
Error Handling
- Invalid credentials:
INVALID_USERNAME,INVALID_PASSWORD - Plan limits:
NO_SCANS_AVAILABLEor messages like "No scans available!" / "No packages available!" - Upload/body issues:
INVALID_CONTENT_TYPE - Missing/expired job:
JOB_NOT_REGISTERED
Refer to the REST API doc for the exact response formats and fields.
Security Notes
- Use HTTPS and secure storage for tokens and IDs
- Acquire
access_tokenclose to usage since it is short‑lived - Always pass
Authorization: Bearer <ACCESS_TOKEN>to protected endpoints
Summary
- Authenticate → Create Job (get URL) → Redirect to scan → (Optional) Check status → Fetch final results later with the stored
JOB_ID.