Jump to content

Carlos_Reyes

Members
  • Content Count

    2
  • Joined

  • Last visited

Posts posted by Carlos_Reyes


  1. Dear colleagues, I don't know if you can help me, I don't know what to do anymore
    I comment:
    I need to send a json through the body of the component of type raw-json using the postman application it works fine but when I want to implement it in delphi it returns the 404 code.

    but when I try to implement in delphi 11.3 it can't I don't know what I'm doing wrong

          TRestClient.NestedElements := False;
          TRestClient.ResetToDefaults;
          TRestClient.BaseURL         := 'https://localhost:8113/firmardocumento/';
          TRestClient.SecureProtocols := [];
          TRestClient.Accept          := '*/*';
          TRestClient.ContentType     := 'application/json';
    
          ////////////////////////////////////////////////////////////////////////
          TRestRequest.Accept   := '*/*';
          TRestRequest.Params.Clear;
    
          TRestRequest.AddParameter('contentType', 'application/JSON', TRESTRequestParameterKind.pkHTTPHEADER, [poDoNotEncode]);
    
          ////////////////////////////////////////////////////////////////////////
          TRestRequest.ClearBody;
          TRestRequest.AddBody(DTEJson, TRESTContentType.ctAPPLICATION_JSON);
    
          ////////////////////////////////////////////////////////////////////////
          TRestRequest.Method := TRESTRequestMethod.rmPOST;
          TRestRequest.Execute;

    I have tried in many ways but it always returns the code 404

    this is the way the json is created and sent

    function TForm1.GetJson: string;
    begin
      Result := '{'
                  + '"mode":"raw",'
                  + '"raw:"'
                  + '{' + EOL
                  + '    "nit": "06142101771068",' + EOL
                  + '    "activo": "True",' + EOL
                  + '    "passwordPri": "",' + EOL
                  + '    "dteJson": {' + EOL
                  + '        "identificacion": {' + EOL
                  + '            "version": 3,' + EOL
                  + '            "ambiente": "01",' + EOL
                  + '            "tipoDte": "03",' + EOL
                  + '            "numeroControl": "DTE-03-00100101-000000000000001",' + EOL
                  + '            "codigoGeneracion": "44A4FE71-8611-4130-8B9B-F0B0A4E2AAF8",' + EOL
                  + '            "tipoModelo": 1,' + EOL
                  + '            "tipoOperacion": 1,' + EOL
                  + '            "tipoContingencia": null,' + EOL
                  + '            "motivoContin": null,' + EOL
                  + '            "fecEmi": "2023-03-12",' + EOL
                  + '            "horEmi": "10:50:48",' + EOL
                  + '            "tipoMoneda": "USD"' + EOL
                  + '        },' + EOL
                  + '        "documentoRelacionado": null,' + EOL
                  + '        "emisor": {' + EOL
                  + '            "nit": "00932969-7",' + EOL
                  + '            "nrc": "161310-4",' + EOL
                  + '            "nombre": "RIVERA MELGAR, MARIA IDALIA",' + EOL
                  + '            "codActividad": "79110",' + EOL
                  + '            "descActividad": "Actividades de agencias de viajes y organizadores de viajes; actividades de asistencia a turistas",' + EOL
                  + '            "nombreComercial": null,' + EOL
                  + '            "tipoEstablecimiento": "02",' + EOL
                  + '            "direccion": {' + EOL
                  + '                "departamento": "08",' + EOL
                  + '                "municipio ": "22",' + EOL
                  + '                "complemento": "1 AV. SUR, FRENTE A CAJA DE CRÉDITO ZACATECOLUCA, DEPARTAMENTO DE LA PAZ"' + EOL
                  + '            },' + EOL
                  + '            "telefono": "",' + EOL
                  + '            "correo": "",' + EOL
                  + '            "codEstableMH": null,' + EOL
                  + '            "codEstable": null,' + EOL
                  + '            "codPuntoVentaMH": null,' + EOL
                  + '            "codPuntoVenta": null' + EOL
                  + '        },' + EOL
                  + '        "receptor": {' + EOL
                  + '            "nit": "02283005-7",' + EOL
                  + '            "nrc": "138504-6",' + EOL
                  + '            "nombre": "104-333 MILTON ODIR VALLADARES  ACEVEDO",' + EOL
                  + '            "codActividad": "94110",' + EOL
                  + '            "descActividad": "Actividades de organizaciones empresariales y de empleadores",' + EOL
                  + '            "nombreComercial": null,' + EOL
                  + '            "direccion": {' + EOL
                  + '                "departamento": "02",' + EOL
                  + '                "municipio": "03",' + EOL
                  + '                "complemento": "02283005-7"' + EOL
                  + '            },' + EOL
                  + '            "telefono": "7774-1113",' + EOL
                  + '            "correo": "carlosreyes210177@gmail.com"' + EOL
                  + '        },' + EOL
                  + '        "otrosDocumentos": null,' + EOL
                  + '        "ventaTercero": null,' + EOL
                  + '        "cuerpoDocumento": [' + EOL
                  + '            {' + EOL
                  + '                "numItem": 1,' + EOL
                  + '                "tipoItem": 3,' + EOL
                  + '                "numeroDocumento": null,' + EOL
                  + '                "codigo": 3,' + EOL
                  + '                "codTributo": null,' + EOL
                  + '                "descripcion": "MESYGEST ANTICONCEPTIVO MENSUAL INYECCIÓN FECHA CALENDARIO",' + EOL
                  + '                "cantidad": 1,' + EOL
                  + '                "uniMedida": 59,' + EOL
                  + '                "precioUni": 4.43362,' + EOL
                  + '                "montoDescu": 0,' + EOL
                  + '                "ventaNoSuj": 0,' + EOL
                  + '                "ventaExenta": 0,' + EOL
                  + '                "ventaGravada": 4.43362,' + EOL
                  + '                "tributos": [' + EOL
                  + '                    "20"' + EOL
                  + '                ],' + EOL
                  + '                "psv": 0,' + EOL
                  + '                "noGravado": 0' + EOL
                  + '            },' + EOL
                  + '            {' + EOL
                  + '                "numItem": 2,' + EOL
                  + '                "tipoItem": 3,' + EOL
                  + '                "numeroDocumento": null,' + EOL
                  + '                "codigo": 6,' + EOL
                  + '                "codTributo": null,' + EOL
                  + '                "descripcion": "TIAMINA B1 VIJOSA VIAL 10 ML",' + EOL
                  + '                "cantidad": 1,' + EOL
                  + '                "uniMedida": 59,' + EOL
                  + '                "precioUni": 2,' + EOL
                  + '                "montoDescu": 0,' + EOL
                  + '                "ventaNoSuj": 0,' + EOL
                  + '                "ventaExenta": 0,' + EOL
                  + '                "ventaGravada": 2,' + EOL
                  + '                "tributos": [' + EOL
                  + '                    "20"' + EOL
                  + '                ],' + EOL
                  + '                "psv": 0,' + EOL
                  + '                "noGravado": 0' + EOL
                  + '            },' + EOL
                  + '            {' + EOL
                  + '                "numItem": 3,' + EOL
                  + '                "tipoItem": 3,' + EOL
                  + '                "numeroDocumento": null,' + EOL
                  + '                "codigo": 9,' + EOL
                  + '                "codTributo": null,' + EOL
                  + '                "descripcion": "PROGESTIN 100 (PROGESTERONA 100MG/ ML) SOLUCION INYECTRABLE",' + EOL
                  + '                "cantidad": 1,' + EOL
                  + '                "uniMedida": 59,' + EOL
                  + '                "precioUni": 3.19469,' + EOL
                  + '                "montoDescu": 0,' + EOL
                  + '                "ventaNoSuj": 0,' + EOL
                  + '                "ventaExenta": 0,' + EOL
                  + '                "ventaGravada": 3.19469,' + EOL
                  + '                "tributos": [' + EOL
                  + '                    "20"' + EOL
                  + '                ],' + EOL
                  + '                "psv": 0,' + EOL
                  + '                "noGravado": 0' + EOL
                  + '            }' + EOL
                  + '        ],' + EOL
                  + '        "resumen": {' + EOL
                  + '            "totalNoSuj": 0,' + EOL
                  + '            "totalExenta": 0,' + EOL
                  + '            "totalGravada": 9.62831,' + EOL
                  + '            "subTotalVentas": 9.62831,' + EOL
                  + '            "descuNoSuj": 0,' + EOL
                  + '            "descuExenta": 0,' + EOL
                  + '            "descuGravada": 0,' + EOL
                  + '            "porcentajeDescuento": 0,' + EOL
                  + '            "totalDescu": 0,' + EOL
                  + '            "tributos": [' + EOL
                  + '                {' + EOL
                  + '                    "codigo": "20",' + EOL
                  + '                    "descripcion": "Impuesto al Valor Agregado13%",' + EOL
                  + '                    "valor": 13' + EOL
                  + '                }' + EOL
                  + '            ],' + EOL
                  + '            "subTotal": 9.62831,' + EOL
                  + '            "ivaPerci1": 0,' + EOL
                  + '            "ivaRete1": 0,' + EOL
                  + '            "reteRenta": 0,' + EOL
                  + '            "montoTotalOperacion": 10.87999,' + EOL
                  + '            "totalNoGravado": 0,' + EOL
                  + '            "totalPagar": 10.87999,' + EOL
                  + '            "totalLetras": "Diez con 88/100",' + EOL
                  + '            "saldoFavor": 0,' + EOL
                  + '            "condicionOperacion": 1,' + EOL
                  + '            "pagos": [' + EOL
                  + '                {' + EOL
                  + '                    "codigo": "01",' + EOL
                  + '                    "montoPago": 10.87999,' + EOL
                  + '                    "plazo": null,' + EOL
                  + '                    "referencia": "",' + EOL
                  + '                    "periodo": null' + EOL
                  + '                }' + EOL
                  + '            ],' + EOL
                  + '            "numPagoElectronico": null' + EOL
                  + '        },' + EOL
                  + '        "extension": {' + EOL
                  + '            "nombEntrega": null,' + EOL
                  + '            "docuEntrega": null,' + EOL
                  + '            "nombRecibe": null,' + EOL
                  + '            "docuRecibe": null,' + EOL
                  + '            "observaciones": null,' + EOL
                  + '            "placaVehiculo": null' + EOL
                  + '        },' + EOL
                  + '        "apendice": null' + EOL
                  + '    }' + EOL
                  + '}' + EOL
                  + '}';
    end;

     

    PostMan.png

×