Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Visual FoxPro Web API Examples

Primary Categories

ABN AMRO
AWS Translate
Activix CRM
Adyen
Amazon DynamoDB
Amazon MWS
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bitfinex v2 REST
Bluzone
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
ETrade
Egypt ITIDA
Etsy
Facebook
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
IntakeQ
Jira
Lightspeed
MYOB
Magento

MercadoLibre
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Okta OAuth/OIDC
OneLogin OIDC
OneNote
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
SimpleTexting
Square
Stripe
SugarCRM
Trello
Twilio
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yousign
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Visual FoxPro) SII POST boleta.electronica.envio

Almacenamiento de un conjunto de boletas en el SII

For more information, see https://www4c.sii.cl/bolcoreinternetui/api/

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loHttp
LOCAL lnSuccess
LOCAL loReq
LOCAL lcXmlStr
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcRut_emisor
LOCAL lcRut_envia
LOCAL lnTrackid
LOCAL lcFecha_recepcion
LOCAL lcEstado
LOCAL lcFile

* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

loHttp = CreateObject('Chilkat_9_5_0.Http')

* Implements the following CURL command:

* curl -X POST "https://pangal.sii.cl/recursos/v1/boleta.electronica.envio" -H  "accept: application/json" 
*   -H  "User-Agent: Mozilla/4.0 ( compatible; PROG 1.0; Windows NT)"
*   -H  "Cookie: YZVQNQY4J5DT9" -H  "Content-Type: multipart/form-data"
*   -F "rutSender=1234" -F "dvSender=xyz" -F "rutCompany=9999" -F "dvCompany=abc"
*   -F "archivo=@starfish20.jpg;type=image/jpeg"

* Use the following online tool to generate HTTP code from a CURL command
* Convert a cURL Command to HTTP Source Code

loReq = CreateObject('Chilkat_9_5_0.HttpRequest')
loReq.HttpVerb = "POST"
loReq.Path = "/recursos/v1/boleta.electronica.envio"
loReq.ContentType = "multipart/form-data"
loReq.AddParam("rutSender","66666666")
loReq.AddParam("dvSender","6")
loReq.AddParam("rutCompany","60803000")
loReq.AddParam("dvCompany","K")

* Add an XML file that contains something like this:
*   <?xml version="1.0" encoding="ISO-8859-1"?>
*   <EnvioBOLETA version="1.0" xmlns="http://www.sii.cl/SiiDte" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sii.cl/SiiDte EnvioBOLETA_v11.xsd">
*     <SetDTE ID="SetDocB0T39_20201103_131999">
*       <Caratula version="1.0">
* ...
lcXmlStr = "..."
lnSuccess = loReq.AddStringForUpload2("archivo","envioBoleta.xml",lcXmlStr,"ISO-8859-1","text/xml")

loReq.AddHeader("Expect","100-continue")
loReq.AddHeader("User-Agent","Mozilla/4.0 ( compatible; PROG 1.0; Windows NT)")
loReq.AddHeader("Cookie","TOKEN=YZVQNQY4J5DT9")
loReq.AddHeader("accept","application/json")
loReq.AddHeader("Content-Type","multipart/form-data")

* For debugging, you can save the exact HTTP request sent and response received
* to a session log file:
loHttp.SessionLogFilename = "someDir/sessionLog.txt"

* Use one of the following domains, depending on the environment:
* pangal.sii.cl  - Certification Environment
* rahue.sii.cl      - Production Environment
loResp = loHttp.SynchronousRequest("pangal.sii.cl",443,1,loReq)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loReq
    CANCEL
ENDIF

loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
loJResp = CreateObject('Chilkat_9_5_0.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loResp.Header
    ? "Failed."
    RELEASE loResp
    RELEASE loHttp
    RELEASE loReq
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

RELEASE loResp

* Sample JSON response:
* (Sample code for parsing the JSON response is shown below)

* {
*   "rut_emisor": "45000054-K",
*   "rut_envia": "83154595-0",
*   "trackid": 1014,
*   "fecha_recepcion": "2020-09-01 20:30:10",
*   "estado": "REC",
*   "file": "boleta-2020-09-01-001.xml"
* }

* Sample code for parsing the JSON response...
* Use the following online tool to generate parsing code from sample JSON:
* Generate Parsing Code from JSON

lcRut_emisor = loJResp.StringOf("rut_emisor")
lcRut_envia = loJResp.StringOf("rut_envia")
lnTrackid = loJResp.IntOf("trackid")
lcFecha_recepcion = loJResp.StringOf("fecha_recepcion")
lcEstado = loJResp.StringOf("estado")
lcFile = loJResp.StringOf("file")

RELEASE loHttp
RELEASE loReq
RELEASE loSbResponseBody
RELEASE loJResp


 

© 2000-2021 Chilkat Software, Inc. All Rights Reserved.