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 ASP .NET Core solution that comes with the EdiNation Inhouse product.
InHouse API for ASP .NET Core on GitHub
Prerequisites
To complete this tutorial, you'll need the following:
- Visual Studio 2022, which supports .NET 6.0.
- Download Postman - it's an application to consume/test your API.
- EDI test file(s) - the API supports X12, EDIFACT, EANCOM, HL7, NCPDP, VDA, and EDIGAS. If you don't have a test file, use one of ours - X12 HIPAA, X12, EDIFACT.
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/v2/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/v2/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 environment variables add the following variable:
Name | Value |
---|---|
EDINATION_AUTHAPI_URL | https://api.edination.com/v2 |
For debugging, add a variable in the launchSettings.json file:
Debug the ASP .NET application in Visual Studio
- Download EdiNation Inhouse, unzip it, and navigate to folder edifabric-api-aspnet.
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.ASPNET.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.
- Run the EdiFabric.Api.ASPNET project in debug mode.
Test the ASP .NET application
- 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 ASP.NET application URL}/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 |
- 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.
- Finally, hit the Send button and inspect the response body:
Next steps
Learn about the in-house edition of EDI API.
Learn about how to use Inhouse EDI API as AWS Lambda
Learn about how to use InHouse EDI API as Azure Function
Comments
0 comments
Please sign in to leave a comment.