# Python
Python is used to connect to Infocon's API. All of the programming can be found in PYP sw_edi.py.
WARNING
Python programs in the test system need to have the _test added to the name. For this program the name is sw_edi_test.py in the test system.
# Token
token()
This is used to get a brand new access token as well as a brand new refresh token. This is done by sending our username and password. This really should only be done once every couple of years when the refresh token expires.
The username (field 3), password (field 4), url (field 10), timeout (field 8) and subscription key (field 12) are automatically pulled from SYSMON SW.EDI.TOKENS.
# Refresh Token
refresh_token()
This is used to get a new access token using our refresh token. Think of the refresh token as our key and the access token is our short-lived token.
The refresh token (field 2), url (field 7), timeout (field 8) and subscription key (field 12) are automatically pulled from SYSMON SW.EDI.TOKENS.
# Receive Orders
receive_orders(url)
This is used to check for new purchase orders. It accepts a url as a required argument.
The access token (field 1) and subscription key (field 12) are automatically pulled from SYSMON SW.EDI.TOKENS. The timeout is pulled from SYSMON SW.EDI.ORDERS field 7.
# Send Acknowledgment
send_ack(json_to_post)
This is used to send an acknowledgment. It accepts the stringified JSON as a required arguement. The JSON should be the acknowledgment payload.
The access token (field 1) and subscription key (field 12) are automatically pulled from SYSMON SW.EDI.TOKENS.
The url (field 4) and timeout (field 3) are pulled from SYSMON SW.EDI.ACK.
# Send Invoice
send_invoice(json_to_post)
This is used to send an invoice. It accepts the stringified JSON as a required arguement. The JSON should be the invoice payload.
The access token (field 1) and subscription key (field 12) are automatically pulled from SYSMON SW.EDI.TOKENS.
The url (field 4) and timeout (field 7) are pulled from SYSMON SW.EDI.INVOICES.
# Headers
It is necessary to send the following header:
Ocp-Apim-Subscription-Key: 65ec...
The exact key is stored in SYSMON SW.EDI.TOKENS field 12.