My goal is to transfer data in JSON format from the SAP server to a local SQL database, after which Ignition will communicate with the database to retrieve the associated value. They wish to send data via API. What's the best course of action here? I have never before worked with an API.
Which end will call the API?
If you intend for the SAP system to push date to Ignition by calling an API offered by Ignition, you will need to create that API. The typical method to do so is to use Ignition's WebDev module and attach suitable jython scripts to endpoints.
If you intend for Ignition to pull this data from SAP, this can be done with the Ignition Platform's native scripting functionality, particularly system.net.httpClient()
.
Share more information?
I am using web dev module so that SAP can push data.
Created this script to show data in Perspective table.
def doPost(request, session):
data= request['data']
system.perspective.sendMessage('table-data', payload = {'data':data},scope='session',sessionId = '3d5297b0-7a38-47bf-92a7-a9488d57e880')
return{'response': 'success'}
and wrote script in table too,
def onMessageReceived(self, payload):
data = payload['data']
self.props.data = data
# implement your handler here
But my end goal is to move this data into database.
Thanks,