Menu

DONE: Ability to send HTTP POST requests

+2 votes

Our main ERP system (along with many other programs/services these days) has an API that uses HTTP POST requests to allow integrations with other programs.

Along with the new webrequest feature, this could open dbFront to a new level of integration with external resources.

in Features (Done) by (2.3k points)
recategorized by
@Daniel, I knew this was coming ;)

2 Answers

0 votes
 
Best answer

dbFront 1.3.2.2081 extends the WebRequest action so that it allows you to send Get, Post, Head, Put and Delete requests.

In addition you can now include:

  • Request Headers including fields and expressions.
  • Request Body which can also resolve fields and expressions.

WebRequest has also been updated to allow receiving Binary object which it can pass to a stored procedure, save in a Blob field, or display on screen. This has been tested with the API provided by CraftMyPDF and it works extremely well.

dbFront provides 4 optional fields to save or for the Stored Procedure call.

  • {%webrequest_status%} - Returns the Status Code as integer or text depending on the field type.
  • {%webrequest_contenttype%} - Returns the result mime type, e.g. "application/pdf"
  • {%webrequest_data%} - Returns the Text, Json, or XML data
  • {%webrequest_attachment%} - Returns the Binary/Blob data

dbFront can also optionally indent any received JSON.

by (64.3k points)
edited by
+1 vote

In case it helps anyone else... I found this code sample from Microsoft that adds GET/POST functionality to SQL Server with a CLR function/procedure.

It still would be better to have this functionality at the front-end to avoid consuming database server resources, but our load is light enough that it should work for now.

https://github.com/microsoft/sql-server-samples/tree/master/samples/features/sql-clr/Curl

by (2.3k points)
Thanks for this suggestion.  It is even better because the database server can make the requests without any direct user involvement as different data events happen.
Fully agree that this is a good solution.  I've done similar to read/write files to disk, or to download/upload files via FTP/sFTP etc.
Welcome to the dbFront Q&A site, where you can ask questions and receive answers from other members of the community.
 | Minimalist Answer Theme by Digitizor Media
 |
Powered by Question2Answer
...