SahamatiNet
  • Background
  • SahamatiNet POC
    • Introduction
    • Applications
    • Observability
    • Integration Steps
      • Sandbox Onboarding
      • IAM APIs
      • CR APIs
      • Integration with Router
        • Sample Code Snippets
          • Python
          • Java
          • JavaScript
          • GoLang
          • C#
        • Router APIs Specifications
          • FIU API Specification
          • AA API Specification
          • FIP API Specification
      • ReBIT Workflows using Router
        • Account Discovery & Linking
        • Consent Workflow
        • FI Request Workflow
    • Integration with Simulators
      • AA Simulator
      • FIP Simulator
      • FIU Simulator
    • Validation of Integration
  • Glossary
  • Guidelines
  • Frequently Asked Questions
  • How To Guides
    • How To Onboard to Sandbox ?
    • How To Decide on an Entity ID ?
    • How To Generate a Certificate ?
    • How To Generate Tokens ?
Powered by GitBook
LogoLogo

Copyright ยฉ 2025 - Sahamati Foundation

On this page

Was this helpful?

Export as PDF
  1. No Longer Relevent
  2. Technical Specifications
  3. Router API Specs
  4. Integration using Simulator

Customisation of Mock Entity and Responses

Was this helpful?

This page explains how to use APIs to create custom mock entities for integration purposes. Additionally, responses for any scenario can be simulated by adding a custom expected response to a specific mock entity. The behavior of the created mock entities will default to the Response Simulator.

Overview:

The Response Simulator is built to handle custom entities and responses for any request, while also mimicking the behavior of real Entity Protocol APIs. It offers a controlled environment for developers to test and validate custom scenarios without depending on the default behavior of the Response Simulator.

Authorization:

All the APIs listed below require a user token for authorization. Onboarded users can generate a token using their credentials, which can then be used to create mock entities, configure custom responses, and more.

We recommend to use below postman collection for quicker access

Regenerate the User Token after creating the mock entity to enable access to the newly created entity.

Identity & Access Management
7KB
Simulator-service.postman_collection.json

Configure a custom response for a mock entity

post

Add a custom response simulation for a given entity, endpoint, response code, and scenario.

Authorizations
Header parameters
AuthorizationstringRequiredExample: Bearer <user-token>
Body
entityIdstringRequiredExample: FIP-SIMULATOR
endpointstringRequiredExample: /Consent/Notification
responseCodeintegerRequiredExample: 400
scenariostringRequiredExample: FIP-SIMULATOR-400-Error
Responses
200
Successfully added the response simulation.
application/json
400
Bad request due to missing required fields.
application/json
401
Unauthorized due to missing or invalid authorization header.
application/json
409
Conflict due to an existing entity with the same endpoint and response code.
application/json
post
POST /simulate/v2/response/add HTTP/1.1
Host: api.sandbox.sahamati.org.in
Authorization: Bearer <user-token>
Content-Type: application/json
Accept: */*
Content-Length: 281

{
  "entityId": "FIP-SIMULATOR",
  "endpoint": "/Consent/Notification",
  "responseCode": 400,
  "response": {
    "ver": "2.0.0",
    "txnid": "0b811819-9044-4856-b0ee-8c88035f8858",
    "timestamp": "2024-09-23T07:40:34.978Z",
    "errorCode": "BadRequest",
    "errorMsg": "BadRequest"
  },
  "scenario": "FIP-SIMULATOR-400-Error"
}
{
  "version": "1.0.0",
  "timestamp": "2024-09-25T06:52:19.750Z",
  "entityId": "FIP-SIMULATOR",
  "message": "FIP-SIMULATOR added successfully."
}

List all configured responses

post

To list all the custom responses configured for the given entity

Authorizations
Header parameters
AuthorizationstringRequiredExample: Bearer <User-Token>
Body
entityIdstringRequiredExample: FIP-SIMULATOR
Responses
200
Successfully retrieved response list
application/json
400
Bad Request - Missing required fields
application/json
401
Unauthorized - Missing authorization header
application/json
404
Not Found - No data for given entity ID
application/json
post
POST /simulate/v2/response/list HTTP/1.1
Host: api.sandbox.sahamati.org.in
Authorization: Bearer <User-Token>
Content-Type: application/json
Accept: */*
Content-Length: 28

{
  "entityId": "FIP-SIMULATOR"
}
{
  "ver": "1.0.0",
  "timestamp": "2024-09-25T07:05:54.036Z",
  "result": [
    {
      "entityId": "FIP-SIMULATOR",
      "endpoint": "/Consent/Notification",
      "scenario": "FIP-SIMULATOR-400-Error",
      "response": {
        "ver": "2.0.0",
        "txnid": "0b811819-9044-4856-b0ee-8c88035f8858",
        "timestamp": "2024-09-23T07:40:34.978Z",
        "errorCode": "InvalidRequest",
        "errorMsg": "InvalidRequest"
      },
      "responseCode": 400
    }
  ]
}
  • Overview:
  • Authorization:
  • POSTCreate Mock Entity
  • POSTConfigure a custom response for a mock entity
  • POSTList all configured responses

Create Mock Entity

post

Register a new custom mock entity using user token.

Header parameters
AuthorizationstringRequiredExample: Bearer <UserToken>
Body
verstringRequiredExample: 1.0
timestampstring ยท date-timeRequiredExample: 2024-08-28T01:58:50.505Z
txnidstringRequiredExample: 1fbb-11ed-861d-0242
typestringRequiredExample: FIP
Responses
200
Successful onboarding of the entity
application/json
400
Bad Request due to certificate existence
application/json
401
Unauthorized access due to invalid token
application/json
409
Conflict due to entity already existing
application/json
post
POST /iam/v1/entity/mock/register HTTP/1.1
Host: api.sandbox.sahamati.org.in
Authorization: Bearer <UserToken>
Content-Type: application/json
Accept: */*
Content-Length: 763

{
  "ver": "1.0",
  "timestamp": "2024-08-28T01:58:50.505Z",
  "txnid": "1fbb-11ed-861d-0242",
  "type": "FIP",
  "entityinfo": {
    "name": "entityId_mock_FIP",
    "id": "entityId_mock_FIP",
    "entityhandle": "",
    "Identifiers": [
      {
        "category": "STRONG",
        "type": "MOBILE"
      }
    ],
    "baseurl": "",
    "fitypes": [
      ""
    ],
    "certificate": {
      "alg": "RS256",
      "e": "AQAB",
      "kid": "4nEXdaiPFssssssIsssYsaslyf",
      "kty": "RSA",
      "n": "uh0fNzOYK2L2wGzixMLN-pOIHDH1tuA3rk6MmW39Q0VbAHWXmn0fZpS88hcIARmsPbbNXAW59VDCGEgPd49VVfiOeENI8PqliNml8gB1C1oGkpnAcda8O4v5kd_ZN4YZcLYqHyv9L8RnBidOzXzi-CxdgoFtM3pAnUYBERbbYi8LK5em8mBCixKuX_NszbrZiT14SY1AglNEWNPgibt3EMzGSxGyWyOgSEfsaQ4HGlppPU5lkWNx1GqktYelDxE7VQDNOGsoS1l03_JVr1oyYIA-1-M9ndq4Cjx3x9QFfaPts8MGw5yWSZCugbIeoBPzHmvlgm3CiGgqFQVrL1mJ2w",
      "use": "sig"
    },
    "inboundports": [
      ""
    ],
    "outboundports": [
      ""
    ],
    "ips": [
      ""
    ]
  }
}
{
  "ver": "1.0.0",
  "timestamp": "2024-09-25T10:01:19.942498808Z",
  "txnId": "1fbb-11ed-861d-0242",
  "message": "Entity successfully onboarded.",
  "entity": {
    "id": "test1",
    "name": "test1",
    "status": "ACTIVE"
  }
}