emnify · Arazzo Workflow

emnify Suspend SIM When Active

Version 1.0.0

Authenticate, read a SIM, and suspend it only when it is currently Activated.

1 workflow 1 source API 1 provider
View Spec View on GitHub IoTInternet of ThingsCellular ConnectivityIoT SIMeSIMConsumer eSIMSGP.32M2MNTN-IoTSatelliteSuperNetworkArazzoWorkflows

Provider

emnify

Workflows

suspend-sim-when-active
Suspend an Activated SIM to stop accruing charges.
Authenticates, fetches the SIM by ID, and suspends it only when its current status is Activated.
3 steps inputs: applicationToken, simId outputs: iccid, suspendedSimId
1
authenticate
authenticate
Exchange the application token for an auth_token used as a Bearer token.
2
getSim
sim-by-id-get
Retrieve SIM details so its current status can be evaluated.
3
suspendSim
sim-by-id-patch
Update the SIM status to Suspended (id 2) to stop accruing charges.

Source API Descriptions

Arazzo Workflow Specification

emnify-suspend-sim-when-active-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: emnify Suspend SIM When Active
  summary: Authenticate, read a SIM, and suspend it only when it is currently Activated.
  description: >-
    A cost-control flow. emnify charges for activated SIMs, so this workflow
    authenticates, retrieves the SIM to inspect its current status, and branches:
    when the SIM is Activated (status id 1) it patches the status to Suspended
    (id 2); otherwise it ends without making a change. Every step spells out its
    request inline, including the Bearer Authorization header threaded from the
    authenticate step.
  version: 1.0.0
sourceDescriptions:
- name: emnifyApi
  url: ../openapi/emnify-api-openapi.yml
  type: openapi
workflows:
- workflowId: suspend-sim-when-active
  summary: Suspend an Activated SIM to stop accruing charges.
  description: >-
    Authenticates, fetches the SIM by ID, and suspends it only when its current
    status is Activated.
  inputs:
    type: object
    required:
    - applicationToken
    - simId
    properties:
      applicationToken:
        type: string
        description: emnify application token used to obtain an auth_token.
      simId:
        type: integer
        description: The numeric ID of the SIM to inspect and suspend.
  steps:
  - stepId: authenticate
    description: Exchange the application token for an auth_token used as a Bearer token.
    operationId: authenticate
    requestBody:
      contentType: application/json
      payload:
        application_token: $inputs.applicationToken
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      authToken: $response.body#/auth_token
  - stepId: getSim
    description: Retrieve SIM details so its current status can be evaluated.
    operationId: sim-by-id-get
    parameters:
    - name: sim_id
      in: path
      value: $inputs.simId
    - name: Authorization
      in: header
      value: Bearer $steps.authenticate.outputs.authToken
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      statusId: $response.body#/status/id
      iccid: $response.body#/iccid
    onSuccess:
    - name: simActivated
      type: goto
      stepId: suspendSim
      criteria:
      - context: $response.body
        condition: $.status.id == 1
        type: jsonpath
    - name: simNotActivated
      type: end
      criteria:
      - context: $response.body
        condition: $.status.id != 1
        type: jsonpath
  - stepId: suspendSim
    description: Update the SIM status to Suspended (id 2) to stop accruing charges.
    operationId: sim-by-id-patch
    parameters:
    - name: sim_id
      in: path
      value: $inputs.simId
    - name: Authorization
      in: header
      value: Bearer $steps.authenticate.outputs.authToken
    requestBody:
      contentType: application/json
      payload:
        status:
          id: 2
    successCriteria:
    - condition: $statusCode == 204
    outputs:
      suspendedSimId: $inputs.simId
  outputs:
    iccid: $steps.getSim.outputs.iccid
    suspendedSimId: $steps.suspendSim.outputs.suspendedSimId