Xero

14

Solutions

28

Contributors

Xero develops cloud-based accounting software for small and medium-sized businesses. The key features of Xero include automatic bank and credit card account feeds, invoicing, accounts payable, expense claims, fixed asset depreciation, purchase orders, and standard business and management reporting. It offers a free API that enables customers and 3rd-party software vendors to integrate external applications with Xero. It also incorporates a payroll feature for users in the Australian and United States markets. All financial data is stored in the cloud on a single unified ledger, allowing users to work in the same set of books regardless of location or operating system.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi.  I am using the following code to catch errors in the Xero API.The following has the ValidationException, but there are other exceptions like .APIException and .BadRequestException
How do I get the information on Exceptions if there are more than one of these types of Exception?      

Catch ex As Xero.Api.Infrastructure.Exceptions.ValidationException

            For Each v In ex.ValidationErrors
                System.Diagnostics.Debug.WriteLine(v.Message)
                oValidationErrors = oValidationErrors & " " & v.Message
            Next
            Response.Write("Error Line Details " & oValidationErrors)

        End Try
0
Microsoft Azure 2017
LVL 13
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Hi

I am using my local host to authenticate into the Xero API

Dim myxerocallbackurl = "https://localhost:51970/Default.aspx"

but am getting the following error

oauth_problem=parameter_rejected&oauth_problem_advice=Callback%20url%20is%20not%20in%20the%20registered%20callback%20domain

what are the possible causes? In my Xero app do I have to specify the local host?
0
Hi

I use the following VB.net code to authenticate against the Xero API. It worked fine on my local machine
but I published the site and changed the post back url from my local machine to that of the published site and it doesn't work

    Protected Function XeroAuthenticate(inpage As Page, authpagereturnedauthentication As Boolean, incode As String) As XeroCoreApi
        ' This procedure will return w working XeroCoreApi if successful and nothing otherwise
        ' Set client secrets for general use and then load any override ones from the web.config file
        Dim myxeroconsumer As New Consumer("xxx", "yyyy")
        Dim myxerouser = New ApiUser() With {.Name = "mxx@yahoo.com"}

        ' If user defined ID and Secrets exist then use those instead
        If Not System.Configuration.ConfigurationManager.AppSettings("XeroAPIClientId") Is Nothing Then
            If Not System.Configuration.ConfigurationManager.AppSettings("XeroAPIClientSecret") Is Nothing Then
                If System.Configuration.ConfigurationManager.AppSettings("XeroAPIClientId").ToString <> "" Then
                    myxeroconsumer = New Consumer(System.Configuration.ConfigurationManager.AppSettings("XeroAPIClientId").ToString, System.Configuration.ConfigurationManager.AppSettings("XeroAPIClientSecret").ToString)
                End If
            End If
        End If

        ' Define Page Call Information
        'Dim myxerocallbackurl = "http://localhost:62054/Default.aspx"
        

Open in new window

0
Hi

I am using the following VB.net code to connect to the Xero API in my web page. I also want to be use the  "myxeroapi" variable on a button click

on the page. Do I use session variables? If so what would the code look like?

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim myxeroapi As XeroCoreApi
        If IsPostBack = False Then
            'SO PAGE LOADS TWICE
            If Request.QueryString("oauth_verifier") Is Nothing Then
                'FIRST LOAD ALLOWS YOU TO AUTH IN
                myxeroapi = XeroAuthenticate(Me, False, "")
            Else
                'SECOND LOAD LET'S YOU DO SOMETHING
                myxeroapi = XeroAuthenticate(Me, True, "")
                If Not myxeroapi Is Nothing Then

                    Dim i As Integer = myxeroapi.Contacts.Find.Count 'Quick Test

                    Call oCreateInvoice(myxeroapi)

                End If
            End If
        End If
    End Sub

Open in new window

0
Hi. I am using the following VB.net code in ASP.net to create authenticate the user and then
create an invoice. The authentication works but then there is a problem with one line of code
  .Contact = pContact
The error is "Value of type 'Contact' cannot be converted into 'Contact'"

       
Imports Xero.Api.Core
Imports Xero.Api.Infrastructure.Interfaces
Imports Xero.Api.Example.Applications.Public
Imports Xero.Api.Infrastructure.OAuth
Imports System.Collections.Concurrent
Imports Xero.Api.Core.Model
Imports Xero.Api.Core.Model.Invoice





Public Class WebForm1

    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim myxeroapi As XeroCoreApi
        If IsPostBack = False Then
            'SO PAGE LOADS TWICE
            If Request.QueryString("oauth_verifier") Is Nothing Then
           
                myxeroapi = XeroAuthenticate(Me, False, "")
            Else

                myxeroapi = XeroAuthenticate(Me, True, "")
                If Not myxeroapi Is Nothing Then

                    Dim i As Integer = myxeroapi.Contacts.Find.Count 'Quck Test
                    Call oCreateInvoice(myxeroapi)


                End If
            End If
        End If
    End Sub



    Sub oCreateInvoice(ByVal myxeroapi As XeroCoreApi)

        Dim oEx As String

        Try
            Dim pContact As New Contact
            pContact.Name = "Test Company"

            'Create the list of 

Open in new window

0
Hi. In the following VB.net code use with the Xero API I get the error "Name is not a member of Contact"
Why would this be

    Sub oCreateContact()
        Dim api = New Xero.Api.Example.Applications.[Private].Core(False)
        Dim newContact As Contact = New Contact()
        newContact.Name = "Metal Fencing"
        newContact.FirstName = "John"
        newContact.LastName = "Smith"
        newContact.EmailAddress = "john@metalfencing.com"
        api.Contacts.Create(newContact)
    End Sub

Open in new window

0
Hi. I am using the code below to connect to the Xero API and authenticate the user. The code then takes the user to the page "http://localhost:62054/AccountingXero.aspx"
where I want to then refer to the API again. How do I refer to the myxeroapi variable again on that page. I am not sure if a session variable would
work.

Imports Xero.Api.Core
Imports Xero.Api.Infrastructure.Interfaces
Imports Xero.Api.Example.Applications.Public
Imports Xero.Api.Infrastructure.OAuth
Imports System.Collections.Concurrent

Public Class WebForm1

    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim myxeroapi As XeroCoreApi
        If IsPostBack = False Then
            If Request.QueryString("oauth_verifier") Is Nothing Then
                myxeroapi = XeroAuthenticate(Me, False, "")
            Else
                myxeroapi = XeroAuthenticate(Me, True, "")
                If Not myxeroapi Is Nothing Then
                    Response.Write(myxeroapi.organisation.name)
                End If
            End If
        End If
    End Sub



    Protected Function XeroAuthenticate(inpage As Page, authpagereturnedauthentication As Boolean, incode As String) As XeroCoreApi
        ' This procedure will return w working XeroCoreApi if successful and nothing otherwise
        ' Set client secrets for general use and then load any override ones from the web.config file
        Dim myxeroconsumer As New

Open in new window

0
Hi. I am using the following VB.net code in my ASP.net WebForms project to connect to the Xero accounting API.
It takes me to the Xero login and allows me to log in and then click the button to stay connected for 30  minutes
but then gives me the error in the attached image.  I have a web page called AccountingXero.aspx so I am not sure what I
have done wrong

Imports Xero.Api.Core
Imports Xero.Api.Infrastructure.Interfaces
Imports Xero.Api.Example.Applications.Public
Imports Xero.Api.Infrastructure.OAuth
Imports System.Collections.Concurrent

Public Class WebForm1

    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim myxeroapi As XeroCoreApi
        If IsPostBack = False Then
            If Request.QueryString("oauth_verifier") Is Nothing Then
                myxeroapi = XeroAuthenticate(Me, False, "")
            Else
                myxeroapi = XeroAuthenticate(Me, True, "")
                If Not myxeroapi Is Nothing Then
                    Response.Write(myxeroapi.organisation.name)
                End If
            End If
        End If
    End Sub



    Protected Function XeroAuthenticate(inpage As Page, authpagereturnedauthentication As Boolean, incode As String) As XeroCoreApi
        ' This procedure will return w working XeroCoreApi if successful and nothing otherwise
        ' Set client secrets for general use and then load any override ones from the web.config

Open in new window

0
In Visual Studio ASP.net C#  I have used the first bit of code before to send information via an API
The second bit of code is an example of how to send an invoice to the Xero accounting system.
How I merge the two to send an invoice to Xero from a C# project

public string PostEmployeeHoursEdit(List<LineEdit> DataLines, int StoreID)
{
    HttpWebResponse Resp;
    try
    {
        string url = "http://www.restaurantmagicbox.com/platform/api/";
        string API_Method = "EmployeeHours";

        string data = "";
        data = Newtonsoft.Json.JsonConvert.SerializeObject(DataLines);

        string Auth = this.txtUsername.Text + ":" + this.txtPassword.Text;
        string webAddress = url + API_Method + "/" + StoreID + "/0";
        HttpWebRequest request = HttpWebRequest.Create(webAddress);
        request.Method = WebRequestMethods.Http.Post;
        request.Headers.Add("Authorization", Auth);
        request.ContentType = "application/json";
        request.ContentLength = data.Length;

        StreamWriter writer = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII);
        writer.Write(data);
        writer.Close();


        Resp = request.GetResponse();
        Stream stream = request.GetResponse().GetResponseStream();
        StreamReader reader = new StreamReader(stream);
        string response = reader.ReadToEnd();

        return "OK";
    }
    catch (WebException wex)
    {
        WebResponse response = wex.Response;
        

Open in new window

0
Hi

I am trying to work with a Visual Studio solution that was developed for Xero accounting software's API.
In the image you see the project explorer with the Xero.Api.Example.MVC is the startup project.
I want to add a webform where I can try to POST an invoice to the API. Where do I do that?
I have experience developing ASP.net VB.net webforms so am a little lost here and just need some advice
on where I can build webforms to build functionality in
1
0
HTML5 and CSS3 Fundamentals
LVL 13
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Hi - we are developing an online service to which users will be able to buy subscriptions and purchase additional ad-hoc services. We are weighing up whether to build a subscription management solution or use something like Chargebee.com. Alternatively we could build this logic ourselves and link through to an online accounting package such as Xero. Advice greatly appreciated. PS - we are in the UK and in addition to taking card payments we also need to be able to setup direct debits and are planning to use Go Cardless to achieve this - just something to throw into the mix. Cheers Ed.
0
Attached is the spreadsheet I am working on, in the Xero Template worksheet in column Q I have created the following formula: =IF(ISBLANK(A2),"","1")

I works ok but I would rather not see the 1 if A2 is blank, unfortunately i am using the same formula in Column A2 so column Q does thing there is something there. Is there a viable substitute that would accomplish the same thing and avoid having the 1 generated across all records?

Also, in column T I have the following formula: =IF(P2="Product charges",400,501) again it works ok but I am trying to avoid having any numbers show if the fields in column P2 are blank. Column P however has a ISBLANK formula as well.
Amazon-Export-to-Xero-Sample.xlsm
0
What do other people using for bookkeeping tools?  I know companies have things like Certify.  There you can snap a photo of your receipts from the mobile app and organize it (date/expense) and it goes straight into the system for approval.  So you don't have to keep physical receipts and papers.  
What about personal or like independent consulting firm.  Is there other free tools like that or cheaper ones?
Please advice.

Thanks.
0
I'm looking for recommendations on what a good cloud accounting / erp solution would be.  We want to move off of our Quickbooks platform.   Recommendations would be great.  If the system has manufacturing / inventory aspects that would be fantastic.
0

Xero

14

Solutions

28

Contributors

Xero develops cloud-based accounting software for small and medium-sized businesses. The key features of Xero include automatic bank and credit card account feeds, invoicing, accounts payable, expense claims, fixed asset depreciation, purchase orders, and standard business and management reporting. It offers a free API that enables customers and 3rd-party software vendors to integrate external applications with Xero. It also incorporates a payroll feature for users in the Australian and United States markets. All financial data is stored in the cloud on a single unified ledger, allowing users to work in the same set of books regardless of location or operating system.

Top Experts In
Xero
<
Monthly
>

No Top Experts for this time period. Answer questions to earn the title!