Documentation

How to use Inhouse EDI API as Azure Function

Article author
Admin
  • Updated

InHouse EDI API allows you to run EdiNation's EDI translation and validation API in your own cloud or on-prem environment(s).

This tutorial uses the example Azure Function that comes with the EdiNation Inhouse product, to demonstrate how to publish EdiNation Inhouse API as an Azure Function in your own Azure subscription(s).

The example is for .NET isolated process function.

 

Prerequisites

To complete this tutorial you'll need the following:

 

Create an Azure Function in the Azure portal

Azure Functions lets you run your code in a serverless environment. 

Detailed tutorial on how to create an Azure Function. For this tutorial, we created an Azure Function named "edinationtest".

Select to Publish as Code, Runtime stack .NET, and Version 6:

createazurefunction1.png

Then use the default suggestions for the other tabs and finally Create the function.

 

Configure Auth API URL

The Auth API sits in EdiNation's cloud and is called directly from EdiFabric.Api.dll in the following cases:

  • To authenticate the instance of the Inhouse API - this is an HTTP GET request to https://api.edination.com/inhouse/v1/auth, which retrieves an authentication token. This token is valid for 30 days, and the next authentication request will be executed 3 days before the current token expires.
  • To retrieve the EDI models - this is an HTTP GET request to https://api.edination.com/inhouse/v1/models/{id} , which retrieves the selected model. Once retrieved models are loaded in the .NET app domain and remain there until the app domain is unloaded (due to application restart/redeploy/scaling up/down).

In the Azure portal navigate to the function you created in the previous step, and then go to Configuration.

Add a new Application setting:

Name Value
EDINATION_AUTHAPI_URL https://api.edination.com/inhouse/v1

 

createazurefunction2.png

 

Publish the Function from Visual Studio

This edition of EdiFabric.dll can only be used with EdiFabric.Api.dll and not on its own. NuGet packages are also supplied in case you prefer to install local packages instead of referencing dlls.

  • Open solution EdiFabric.Api.Azure.sln in Visual Studio 2022.
  • Ensure the references to EdiFabric.dll and EdiFabric.Api.dll exist.
  • Rebuild the solution and ensure all package dependencies were installed correctly.

createazurefunction3.png

  • Right-click on the project name and select "Publish".
  • Publish it to the Azure Function you created in the first step.

 

Test the Function

  • In the Azure portal go to your function's overview tab, and copy the function URL:

createazurefunction4.png

  • Download and open Postman. Let's test the X12 read operation first.
  • Open a new tab in Postman, select the POST method and add the following request URL (full API reference Swagger/Docs):
{Your function URL}/api/x12/read
  • Go to the Headers tab and add the API key you received when subscribing to EdiNation InHouse API:
Header Key Header Value
Ocp-Apim-Subscription-Key Your API key

createazurefunction5.png

  • Go to the Body tab, select the "binary" content, and then browse to your text X12/HIPAA file.

If you don't have a test file, use one of ours - X12 HIPAA, X12, EDIFACT.

createazurefunction6.png

  •  Finally, hit the Send button and inspect the response body:

createazurefunction7.png

 

Next steps

Learn about the in-house edition of EDI API.

Learn about how to use Inhouse EDI API as AWS Lambda

 

 

Share this:

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.