Login to website
Moderator: Rathinagiri
- tomtagaris
- Posts: 107
- Joined: Tue Aug 23, 2016 2:43 pm
Login to website
Does anyone know how to login to a website using a username and password?
Thanks
Tom
Thanks
Tom
- tomtagaris
- Posts: 107
- Joined: Tue Aug 23, 2016 2:43 pm
Re: Login to website
:the website is from the Ministry of Finance and was on trial for importing invoices but released when it is spring again i will definitely thanks for your help
https://mydata-dev.portal.azure-api.net ... ndinvoices?
https://mydata-dev.portal.azure-api.net ... ndinvoices?
Re: Login to website
Hi Tom.tomtagaris wrote: ↑Fri Sep 06, 2019 11:33 am :the website is from the Ministry of Finance and was on trial for importing invoices but released when it is spring again i will definitely thanks for your help
https://mydata-dev.portal.azure-api.net ... ndinvoices?
Based on your link, I prepared a working piece of the program to connect to the indicated method. As you can see (according to the specification) authorization data must be sent in the header.
Of course, you must prepare a valid xml file containing invoices in advance. I included the sample structure of the xml file in the source, based on the indicated https://apimgmtstu2uzdx6cqwpx6k3.blob.c ... c-v0.5.xsd file.
Code: Select all
#include "hmg.ch"
Function Main
cSampleInvXML:= '<?xml version="1.0" encoding="utf-8"?>' + ;
'<InvoicesDoc>' + ;
' <invoice>' + ;
' <uid>str1234</uid>' + ;
' <mark>str1234</mark>' + ;
' <issuer>' + ;
' <vatNumber>str1234</vatNumber>' + ;
' <country>AD</country>' + ;
' <name>str1234</name>' + ;
' <address>' + ;
' <street>str1234</street>' + ;
' <number>str1234</number>' + ;
' <postalCode>str1234</postalCode>' + ;
' <city>str1234</city>' + ;
' </address>' + ;
' </issuer>' + ;
' <counterpart>' + ;
' <vatNumber>str1234</vatNumber>' + ;
' <country>AD</country>' + ;
' <name>str1234</name>' + ;
' <address>' + ;
' <street>str1234</street>' + ;
' <number>str1234</number>' + ;
' <postalCode>str1234</postalCode>' + ;
' <city>str1234</city>' + ;
' </address>' + ;
' </counterpart>' + ;
' <invoiceHeader>' + ;
' <branch>123</branch>' + ;
' <series>str1234</series>' + ;
' <aa>12345</aa>' + ;
' <issueDate>2012-12-13</issueDate>' + ;
' <invoiceType>1.1</invoiceType>' + ;
' <vatPaymentSuspension>true</vatPaymentSuspension>' + ;
' <currency>AED</currency>' + ;
' <exchangeRate>123.45</exchangeRate>' + ;
' <correlatedInvoices>str1234</correlatedInvoices>' + ;
' <selfPricing>true</selfPricing>' + ;
' <dispatchDate>2012-12-13</dispatchDate>' + ;
' <dispatchTime>12:12:12</dispatchTime>' + ;
' <vehicleNumber>str1234</vehicleNumber>' + ;
' <movePurpose>str1234</movePurpose>' + ;
' </invoiceHeader>' + ;
' <invoiceDetails>' + ;
' <lineNumber>123</lineNumber>' + ;
' <quantity>123.45</quantity>' + ;
' <measurementUnit>123</measurementUnit>' + ;
' <invoiceDetailType>123</invoiceDetailType>' + ;
' <netValue>123.45</netValue>' + ;
' <vatCategory>123</vatCategory>' + ;
' <vatExemptionCategory>123</vatExemptionCategory>' + ;
' <dienergia>' + ;
' <applicationId>str1234</applicationId>' + ;
' <applicationDate>2012-12-13</applicationDate>' + ;
' <doy>str1234</doy>' + ;
' <shipId>str1234</shipId>' + ;
' </dienergia>' + ;
' <discountOption>true</discountOption>' + ;
' <withheldAmount>123.45</withheldAmount>' + ;
' <withheldPercentCategory>123</withheldPercentCategory>' + ;
' <stampDutyPercentCategory>123</stampDutyPercentCategory>' + ;
' <feesAmount>123.45</feesAmount>' + ;
' <feesPercentCategory>123</feesPercentCategory>' + ;
' <otherTaxesPercentCategory>123</otherTaxesPercentCategory>' + ;
' <otherTaxesAmount>123.45</otherTaxesAmount>' + ;
' <deductionsPercentage>123.45</deductionsPercentage>' + ;
' <incomeClassification>' + ;
' <classificationType>123</classificationType>' + ;
' <classificationCategory>123</classificationCategory>' + ;
' <amount>123.45</amount>' + ;
' </incomeClassification>' + ;
' </invoiceDetails>' + ;
' <invoiceSummary>' + ;
' <totalNetValue>123.45</totalNetValue>' + ;
' <totalVatAmount>123.45</totalVatAmount>' + ;
' <totalWithheldAmount>123.45</totalWithheldAmount>' + ;
' <totalFeesAmount>123.45</totalFeesAmount>' + ;
' <totalStampDutyAmount>123.45</totalStampDutyAmount>' + ;
' <totalOtherTaxesAmount>123.45</totalOtherTaxesAmount>' + ;
' <totalDeductionsAmount>123.45</totalDeductionsAmount>' + ;
' <totalGrossValue>123.45</totalGrossValue>' + ;
' <incomeClassification>' + ;
' <classificationType>123</classificationType>' + ;
' <classificationCategory>123</classificationCategory>' + ;
' <amount>123.45</amount>' + ;
' </incomeClassification>' + ;
' </invoiceSummary>' + ;
' </invoice>' + ;
'</InvoicesDoc>'
Msginfo( cSampleInvXML )
AADE_Invoice ( cSampleInvXML )
RETURN
*************************************************************************************
Function AADE_Invoice ( cInvoice_XML )
Local cUserId := "1234" //user id
Local cSubscriptionKey := "abcdefghijkl" //Subscription key which provides access to this API
Local responseHttp:= "", hResponse := {=>}
Local oHttp:= ""
Local cUrl := "https://mydata-dev.azure-api.net/SendInvoices"
BEGIN SEQUENCE WITH {|o| break(o)}
oHttp := Win_OleCreateObject( "MSXML2.ServerXMLHTTP" )
RECOVER USING oErr
MsgStop( oErr:Description, "Error Microsoft XML Core Services (MSXML)" )
oHttp:=""
END SEQUENCE
IF EMPTY(oHttp)
MsgStop ("Error while initializing MSXML" )
RETURN
ENDIF
BEGIN SEQUENCE WITH {|o| break(o)}
ohttp:Open( "POST", cUrl, .F. )
ohttp:setRequestHeader("Content-Type", "text/xml")
ohttp:setRequestHeader("aade-user-id", cUserId) //User Id
ohttp:setRequestHeader("Ocp-Apim-Subscription-Key", cSubscriptionKey) // Subscription key which provides access to this API. Found in your Profile.
//send your XML with invoices
ohttp:Send( cInvoice_XML )
responseHttp := ohttp:ResponseBody() //response from server
RECOVER USING oErr
responseHttp := ""
MsgStop( oErr:Description ,"Error" )
END SEQUENCE
Msgdebug( responseHttp )
hb_jsonDecode ( responseHttp, @hResponse )
Msgdebug ( hResponse )
Msgdebug ("Status code: " ,hb_HGet ( hResponse, "statusCode" ) )
Msgdebug ("Message: " , hb_HGet ( hResponse, "message" ) )
RETURN
- tomtagaris
- Posts: 107
- Joined: Tue Aug 23, 2016 2:43 pm
Re: Login to website
thank you very much
i will try it your help is valuable
thank you very much
i will try it your help is valuable
thank you very much
- tomtagaris
- Posts: 107
- Joined: Tue Aug 23, 2016 2:43 pm
Re: Login to website
ι uses the code and logged in with the site and I get these errors
what can I do
what can I do
Re: Login to website
The error description indicates that you need to add schema information.
Try adding this information to root XML element, as in the attached xml sample. You can validate your XML file based on the schema definition, e.g. on this page: https://www.freeformatter.com/xml-validator-xsd.html
Try adding this information to root XML element, as in the attached xml sample. You can validate your XML file based on the schema definition, e.g. on this page: https://www.freeformatter.com/xml-validator-xsd.html
- tomtagaris
- Posts: 107
- Joined: Tue Aug 23, 2016 2:43 pm
Re: Login to website
UNDERSTAND THE PROBLEM AND THANK YOU VERY MUCH
THAT WOULD LIKE A LITTLE HELP EVER
HOW CAN I SEND MORE THAN ONE INVOICE WITH SAME XML FILE TO WEBSITE
THANKS
THAT WOULD LIKE A LITTLE HELP EVER
HOW CAN I SEND MORE THAN ONE INVOICE WITH SAME XML FILE TO WEBSITE
THANKS
Re: Login to website
It's simple, each next invoice should be between <invoice> ... </invoice> tags.
Simplified structure:
Simplified structure:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<InvoicesDoc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.aade.gr/myDATA/invoice/v1.0 schema.xsd" xmlns="http://www.aade.gr/myDATA/invoice/v1.0">
<!-- 1st invoice -->
<invoice>
<uid>string</uid>
<mark>string</mark>
<issuer>(...)</issuer>
<counterpart>(...)</counterpart>
<invoiceHeader>(...)</invoiceHeader>
<invoiceDetails>(...)</invoiceDetails>
(...)
<invoiceDetails>(...)</invoiceDetails>
<invoiceSummary>(...)</invoiceSummary>
</invoice>
<!-- 2nd invoice -->
<invoice>
<uid>string</uid>
<mark>string</mark>
<issuer>(...)</issuer>
<counterpart>(...)</counterpart>
<invoiceHeader>(...)</invoiceHeader>
<invoiceDetails>(...)</invoiceDetails>
(...)
<invoiceDetails>(...)</invoiceDetails>
<invoiceSummary>(...)</invoiceSummary>
</invoice>
(...)
<!-- n-th invoice -->
<invoice>
<uid>string</uid>
<mark>string</mark>
<issuer>(...)</issuer>
<counterpart>(...)</counterpart>
<invoiceHeader>(...)</invoiceHeader>
<invoiceDetails>(...)</invoiceDetails>
(...)
<invoiceDetails>(...)</invoiceDetails>
<invoiceSummary>(...)</invoiceSummary>
</invoice>
</InvoicesDoc>
- tomtagaris
- Posts: 107
- Joined: Tue Aug 23, 2016 2:43 pm
Re: Login to website
it's so easy
thank you very much
Something else
how can i get data based on this webpage
https://mydata-dev.portal.azure-api.net ... stinvoices?
thank you very much
Something else
how can i get data based on this webpage
https://mydata-dev.portal.azure-api.net ... stinvoices?