Skip to main content

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_ID with your user/session to fetch results later

End-to-End Flow

  1. Authenticate
  2. Create a Job and Get the Scan URL
  3. Redirect the User to the Scan URL
  4. (Optional) Check Job Status
  5. Fetch Final Results (Later)

Android Example (Conceptual)

Button tap handler

  • Call /clientlogin → receive access_token
  • Call /clientgeturl with Authorization: Bearer <access_token> → receive url
  • Parse api_key as <JOB_ID> from url and persist it
  • Launch the browser using Custom Tabs or an ACTION_VIEW intent to open url

Implementation tips

  • Use CustomTabsIntent or Intent(Intent.ACTION_VIEW, Uri.parse(url))
  • Persist JOB_ID (e.g., in local DB or backend mapped to the authenticated user)
  • Optionally poll /check if your UX needs to know when the scan is done

iOS Example (Conceptual)

Button tap handler

  • Call /clientlogin → receive access_token
  • Call /clientgeturl with Authorization: Bearer <access_token> → receive url
  • Parse api_key as <JOB_ID> from url and persist it
  • Open SFSafariViewController or hand off to the system browser with the url

Implementation tips

  • Prefer SFSafariViewController for an in‑app browser experience
  • Persist JOB_ID for later result retrieval via /getcustomerinfo

Web App Example (Conceptual)

On scan button click

  • Authenticate → get access_token
  • Create job → get url (contains api_key)
  • Store JOB_ID in 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_AVAILABLE or 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_token close 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.