Chilkat Online Tools

ERROR!

------------------- GenerateCode ----------------------
---- begin chilkat script ----
// This example assumes the Chilkat API to have been previously unlocked.
// See {{-global_unlock:::Global Unlock Sample-}} for sample code.

new Http http;
ckbool success;

// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>";

new StringBuilder sbResponseBody;
success = http.QuickGetSb("https://api-cpe.sunat.gob.pe/v1/contribuyente/gem/comprobantes/envios/2b229999-9999-4bad-9554-999900d79999",sbResponseBody);
if (success == ckfalse) {
println http.LastErrorText;
return;
}

println "Response status code = ",http.LastStatus;
println sbResponseBody.GetAsString();

---- end chilkat script ----

Python / api-seguridad.sunat.gob.pe / Get Ticket

Back to Collection Items

import sys
import chilkat

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

http = chilkat.CkHttp()

# Adds the "Authorization: Bearer <access_token>" header.
ERROR: Property not found: Http.AuthToken
Assignment type mismatch.  ExpressionType=string, atgType=ERROR:

sbResponseBody = chilkat.CkStringBuilder()
ERROR: Entry not found: Http.QuickGetSb
ERROR: CodeGen:
  emitNewObject:
    atgType: Http
    varName: http
  --emitNewObject
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  emitNewObject:
    atgType: StringBuilder
    varName: sbResponseBody
  --emitNewObject
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
--CodeGen

ERROR: Non-existent Chilkat method:  Http.QuickGetSb
Assignment type mismatch.  ExpressionType=ERROR:, atgType=ckbool

if (success == False):
ERROR: Entry not found: Http.LastErrorText
ERROR: CodeGen:
  emitNewObject:
    atgType: Http
    varName: http
  --emitNewObject
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  emitNewObject:
    atgType: StringBuilder
    varName: sbResponseBody
  --emitNewObject
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
--CodeGen

    print(str(http.get_LastErrorText()))
    sys.exit()

ERROR: Entry not found: Http.LastStatus
ERROR: CodeGen:
  emitNewObject:
    atgType: Http
    varName: http
  --emitNewObject
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  emitNewObject:
    atgType: StringBuilder
    varName: sbResponseBody
  --emitNewObject
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
--CodeGen

print("Response status code = " + str(http.get_LastStatus()))
print(sbResponseBody.getAsString())

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://api-cpe.sunat.gob.pe/v1/contribuyente/gem/comprobantes/envios/2b229999-9999-4bad-9554-999900d79999

Postman Collection Item JSON

{
  "name": "Get Ticket",
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "ey...",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "https://api-cpe.sunat.gob.pe/v1/contribuyente/gem/comprobantes/envios/2b229999-9999-4bad-9554-999900d79999",
      "protocol": "https",
      "host": [
        "api-cpe",
        "sunat",
        "gob",
        "pe"
      ],
      "path": [
        "v1",
        "contribuyente",
        "gem",
        "comprobantes",
        "envios",
        "2b229999-9999-4bad-9554-999900d79999"
      ]
    }
  },
  "response": [
  ]
}