OnRampSDK

Public SDK Packages for using OnRamp.

ORPublicApiRefCore (2.0.0)

Published 2026-06-04 09:44:46 -04:00 by ccurran

Installation

dotnet nuget add source --name OnRampSDK --username your_username --password your_token 
dotnet add package --source OnRampSDK --version 2.0.0 ORPublicApiRefCore

About this package

OnRamp Public API Core Library

OnRamp Public API Core

VB.NET client library for the OnRamp public API.

Install

Public read access:

dotnet nuget add source https://git.onramp-solutions.com/api/packages/OnRampSDK/nuget/index.json --name onrampsdk

Install the package:

dotnet add package ORPublicApiRefCore --source onrampsdk

Basic Usage

Imports ORPublicApiRefCore

Dim api = New OnRampAPI("https://onramp.customer.com/ProductionCopy/")
api.APILogin("api_user", "api_password")

Console.WriteLine(api.SessionId)

api.KeepSessionAlive()
api.LogOut()

APILogin stores the session ID on the OnRampAPI instance, so the overloads without sessId can be used for the rest of the session.

API Queries

Use runQuery for registered API queries.

Use a dictionary when the query parameters are named in OnRamp.

Dim rows = api.runQuery("QL-10000008", New Dictionary(Of String, String) From {
    {"param_name", "param_value"}
})

Use a list when the query expects indexed or positional parameters.

Dim customers = api.runQuery("Q-10010176", New List(Of String) From {"1/1/1900"})

If customers IsNot Nothing AndAlso customers.RecordCount > 0 Then
    customers.MoveFirst()
    Do While Not customers.EOF
        Console.WriteLine(CStr(customers("cusm_id")) & " " & CStr(customers("cusm_name")))
        customers.MoveNext()
    Loop
End If

If a registered query performs an action and returns EXECUTED, the dictionary overload returns Nothing.

Screen Calls

Dim screen = api.ScreenLoad("S2431")

api.ScreenEnterFrame(screen, "01")
api.ScreenEnterMode(screen, ORApiScreenMode.Add)
api.ScreenSetControlValue(screen, "01-01-01", "TaskID ID")
api.ScreenSetControlValue(screen, "01-01-02", "TaskID Desc")
api.ScreenOKCancel(screen, ORApiScreenOKCancel.OK)

Dim errors = api.ScreenGetCurrentErrors(screen)
api.CloseScreen(screen)

Message Boxes And Files

Some screen actions can trigger modal message boxes. Use SetAutoMsgBoxAnswer to choose the automatic answer for future prompts in the current session.

api.SetAutoMsgBoxAnswer(ORApiAutoAnswerMsgBoxOption.Yes)

' Do work that may trigger a modal prompt.

api.SetAutoMsgBoxAnswer(ORApiAutoAnswerMsgBoxOption.None)

The setting is sticky for the session. Reset it to None when finished.

File Download

Dim screen = api.ScreenLoad("S2431")
Dim fileName = CStr(api.ScreenGetControlValue(screen, "01-01-03"))
api.ScreenGetControlFile(screen, "01-01-03", $"C:\Temp\{fileName}")
api.CloseScreen(screen)

Publishing

Private push access requires a Gitea user in the SDKMantainers team and a token:

dotnet nuget add source https://git.onramp-solutions.com/api/packages/OnRampSDK/nuget/index.json --name onrampsdk --username gittea_user_ --password gittea_token --store-password-in-clear-text

Generate README.md and pack without uploading:

.\PushSDKToGit.ps1

Generate README.md, pack, and push to Gitea:

.\PushSDKToGit.ps1 -Upload

Run the local sample app while developing:

dotnet run --project .\samples\ORPublicApiRef.Sample\ORPublicApiRefCore.Sample.vbproj

Full Example

The full example code is included below.

Imports System.IO
Imports ORPublicApiRefCore

Module Program

    Private Const DownloadFolder As String = "C:\Temp"
    Private api As OnRampAPI

    Sub Main(args As String())
        Dim screen As String = Nothing
        Dim loggedIn As Boolean = False

        ' ProductionCopy endpoint.
        Dim envUrl As String = "https://onramp.customerurl.com/ProductionCopy/"

        ' Production endpoint.
        ' Dim envUrl As String = "https://onramp.customerurl.com/Production/"

        api = New OnRampAPI(envUrl)

        Try
            api.APILogin("api_user", "api_password")
            loggedIn = True

            Console.WriteLine("SessionID = " & api.SessionId)

            api.KeepSessionAlive()

            ' Execute query QL-10000008 with named parameter part_type for purchased parts.
            api.runQuery("QL-10000008", New Dictionary(Of String, String) From {
                {"part_type", "P"}
            })

            ' Get data from OnRamp with a specified query number and iterate over results.
            Dim customerData = api.runQuery("Q-10010176", New List(Of String) From {"1/1/1900"})
            If customerData IsNot Nothing AndAlso customerData.RecordCount > 0 Then
                customerData.MoveFirst()
                Do While Not customerData.EOF
                    Dim customerId = Convert.ToString(customerData("cusm_id"))
                    Dim customerName = Convert.ToString(customerData("cusm_name"))
                    Console.WriteLine(customerId & "-" & customerName)

                    Dim customerContacts = api.runQuery("Q-10010177", New List(Of String) From {customerId})
                    PrintContacts(customerContacts)

                    Dim customerOpenInvoices = api.runQuery("Q-10010178", New List(Of String) From {customerId})
                    PrintInvoices(customerOpenInvoices)

                    customerData.MoveNext()
                Loop
            End If

            ' Example of using the API to open screen S2431.
            screen = api.ScreenLoad("S2431")

            ' Get file name from control value and create a save file path.
            Dim fileName = Convert.ToString(api.ScreenGetControlValue(screen, "01-01-03"))
            Dim filePath = Path.Combine(DownloadFolder, fileName)

            ' Download file from that screen control.
            api.ScreenGetControlFile(screen, "01-01-03", filePath)

            ' All API screen functions require the screen instance GUID.
            api.ScreenEnterFrame(screen, "01")
            api.ScreenEnterMode(screen, ORApiScreenMode.Add)

            ' Mimic a user entering data into fields. Use F1 in OnRamp text boxes to get IDs.
            api.ScreenSetControlValue(screen, "01-01-01", "TaskID ID")
            api.ScreenSetControlValue(screen, "01-01-02", "TaskID Desc")

            ' Commit data to the databound frame.
            api.ScreenOKCancel(screen, ORApiScreenOKCancel.OK)

            ' Retrieve a specific value on the screen.
            Dim currentValue = Convert.ToString(api.ScreenGetControlValue(screen, "01-01-01"))
            Console.WriteLine("Current value: " & currentValue)

            ' Retrieve current screen errors.
            Dim errors = Convert.ToString(api.ScreenGetCurrentErrors(screen))
            Console.WriteLine("Screen errors: " & errors)

            ' Jump to a specific grid record by key value.
            api.ScreenGridFind(screen, "01-01-01", "asdf")

            ' Reset sticky modal dialog behavior for this session.
            api.SetAutoMsgBoxAnswer(ORApiAutoAnswerMsgBoxOption.None)

            Console.WriteLine("Example completed successfully.")
        Catch ex As Exception
            PrintApiError(ex)
        Finally
            If Not String.IsNullOrWhiteSpace(screen) Then
                Try
                    api.CloseScreen(screen)
                Catch
                End Try
            End If

            If loggedIn Then
                Try
                    api.LogOut()
                Catch
                End Try
            End If
        End Try
    End Sub

    Private Sub PrintContacts(customerContacts As DTRecordset)
        If customerContacts Is Nothing OrElse customerContacts.RecordCount = 0 Then
            Return
        End If

        customerContacts.MoveFirst()
        Do While Not customerContacts.EOF
            Dim contactName = Convert.ToString(customerContacts("peop_full_name"))
            Dim contactEmail = Convert.ToString(customerContacts("peop_email"))
            Console.WriteLine("  Contact: " & contactName & " " & contactEmail)
            customerContacts.MoveNext()
        Loop
    End Sub

    Private Sub PrintInvoices(customerOpenInvoices As DTRecordset)
        If customerOpenInvoices Is Nothing OrElse customerOpenInvoices.RecordCount = 0 Then
            Return
        End If

        customerOpenInvoices.MoveFirst()
        Do While Not customerOpenInvoices.EOF
            Dim invoiceNumber = Convert.ToString(customerOpenInvoices("ivcm_inv_num"))
            Dim invoiceOpenBalance = Convert.ToString(customerOpenInvoices("ivcm_open_bal"))
            Console.WriteLine("  Invoice: " & invoiceNumber & " " & invoiceOpenBalance)
            customerOpenInvoices.MoveNext()
        Loop
    End Sub

    Private Sub PrintApiError(ex As Exception)
        Console.WriteLine("Error type: " & ex.GetType().Name)
        Console.WriteLine("Error: " & ex.Message)
    End Sub

End Module

Dependencies

ID Version Target Framework
Newtonsoft.Json 13.0.2 net6.0
Newtonsoft.Json 13.0.2 net8.0
Details
NuGet
2026-06-04 09:44:46 -04:00
28
Craig Curran
46 KiB
Assets (2)
Versions (2) View all
2.0.0 2026-06-04
1.0.0 2026-03-06