Skip to content

Instantly share code, notes, and snippets.

@klukiyan
Last active January 22, 2025 13:57
Show Gist options
  • Save klukiyan/641d0770c3cf946d7406c1bc6fbe9676 to your computer and use it in GitHub Desktop.
Save klukiyan/641d0770c3cf946d7406c1bc6fbe9676 to your computer and use it in GitHub Desktop.
API automation.md

[[✱ Creative Wrap]] | #projects XERO accounting API https://developer.xero.com/documentation/api/accounting/accounts

Jobber accounting API link: https://developer.getjobber.com/docs/building_your_app/app_authorization

Jobber

Okay that's great thanks
We already have a zapier pushing quotes from jobber to xero, once quote is approved ..... and then xero makes an invoice.

Just need the rest of the flow

Which is 
1) invoice paid approved quotes is converted into job in jobber
2) job number synced to xero invoice
// © Aaron
https://api.getjobber.com/api/oauth/authorize?response_type=code&client_id=<CLIENT_ID>&redirect_uri=<CALLBACK_URL>&state=<STATE>

⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡ this: https://api.getjobber.com/api/oauth/authorize?response_type=code&client_id=fae54946-80aa-45f1-9489-bbe65db11196&redirect_uri=https://luckygiga.com/cw&state=4321

https://api.getjobber.com/api/oauth/authorize?response_type=code&client_id=fae54946-80aa-45f1-9489-bbe65db11196&redirect_uri=https://luckygiga.com/cw&state=4321
https://luckygiga.com/api/cw?code=eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNDQ0NDkwLCJhcHBfaWQiOiJmYWU1NDk0Ni04MGFhLTQ1ZjEtOTQ4OS1iYmU2NWRiMTExOTYiLCJzY29wZXMiOiIiLCJleHAiOjE3Mjg0MTQxNjN9.n1m95B3jI-Y88V_hX8sWccjFGmSA9o4wV34fPVddEU8&state=4321
https://api.getjobber.com/api/oauth/authorize?response_type=code&client_id=fae54946-80aa-45f1-9489-bbe65db11196&state=4321
https://luckygiga.com/cw?code=eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNDQ0NDkwLCJhcHBfaWQiOiJmYWU1NDk0Ni04MGFhLTQ1ZjEtOTQ4OS1iYmU2NWRiMTExOTYiLCJzY29wZXMiOiIiLCJleHAiOjE3Mjg0MTg5Mjd9.JUEFvA3gnwYrtmd4DrECjncVFbkHNS1S8o-RNBft098&state=4321

eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNDQ0NDkwLCJhcHBfaWQiOiJmYWU1NDk0Ni04MGFhLTQ1ZjEtOTQ4OS1iYmU2NWRiMTExOTYiLCJzY29wZXMiOiIiLCJleHAiOjE3Mjg0MTg5Mjd9.JUEFvA3gnwYrtmd4DrECjncVFbkHNS1S8o-RNBft098


array:2 [▼ // app/Http/Controllers/Projects/CreativeNewController.php:42
  "access_token" => "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjE0NDQ0OTAsImlzcyI6Imh0dHBzOi8vYXBpLmdldGpvYmJlci5jb20iLCJjbGllbnRfaWQiOiJmYWU1NDk0Ni04MGFhLTQ1ZjEtOTQ4OS1iYmU2NWRiMTExOTYiLCJzY29 ▶"
  "refresh_token" => "807dcf8a04058616d2cdf2af538e1417"
]

Jobber:


XERO:

laravel:

https://github.com/langleyfoxall/xero-laravel https://github.com/dcblogdev/laravel-xero

xero docs:

https://developer.xero.com/documentation/sdks-and-tools/libraries/overview app https://developer.xero.com/app/manage


![[Pasted image 20241009142355.png]] https://api-explorer.xero.com/accounting/invoices/getinvoices?query-statuses=PAID

https://login.xero.com/identity/connect/authorize?response_type=code&client_id=D8F0673A98CF4E5D9C1AD48FF5A1372D&redirect_uri=https://luckygiga.com/cw&scope=openid profile email&state=4321
https://luckygiga.com/cw?code=UxP7YYLaZ-_GSG_fzqUARwtVUgMxCiHW8NFx17X4z8U&scope=openid%20profile%20email&state=4321&session_state=l0l93I78QZjpszvaOJuKZA51X5yG8OrEfTZ4K2gfB9I.nJZu7r-HnAdRrbfYYb6GtA

finally fucking works %% https://github.com/dcblogdev/laravel-xero?tab=readme-ov-file %%

Webhook woorks too

[2024-10-12 20:10:00] production.INFO: Xero Webhook received: {"events":[{"resourceUrl":"https://api.xero.com/api.xro/2.0/Invoices/37b255ba-0a14-4cc3-9253-5c8fc63295f5","resourceId":"37b255ba-0a14-4cc3-9253-5c8fc63295f5","tenantId":"1338904c-0aa5-4e82-aa0a-b590ffc14cec","tenantType":"ORGANISATION","eventCategory":"INVOICE","eventType":"UPDATE","eventDateUtc":"2024-10-12T18:09:53.543"}],"firstEventSequence":1,"lastEventSequence":1,"entropy":"LOKVVFOPRJMUKCXFCXYO"}

[2024-10-12 20:10:00] production.INFO: Processed 1 Xero events
[2024-10-15 16:03:42] production.INFO: token source:
[2024-10-15 16:03:42] production.INFO: {
"access_token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjE0NDQ0OTAsImlzcyI6Imh0dHBzOi8vYXBpLmdldGpvYmJlci5jb20iLCJjbGllbnRfaWQiOiJmYWU1NDk0Ni04MGFhLTQ1ZjEtOTQ4OS1iYmU2NWRiMTExOTYiLCJzY29wZSI6InJlYWRfY2xpZW50cyB3cml0ZV9jbGllbnRzIHJlYWRfcmVxdWVzdHMgd3JpdGVfcmVxdWVzdHMgcmVhZF9xdW90ZXMgd3JpdGVfcXVvdGVzIHJlYWRfam9icyB3cml0ZV9qb2JzIHJlYWRfc2NoZWR1bGVkX2l0ZW1zIHdyaXRlX3NjaGVkdWxlZF9pdGVtcyByZWFkX2ludm9pY2VzIHJlYWRfam9iYmVyX3BheW1lbnRzIHJlYWRfdXNlcnMiLCJhcHBfaWQiOiJmYWU1NDk0Ni04MGFhLTQ1ZjEtOTQ4OS1iYmU2NWRiMTExOTYiLCJ1c2VyX2lkIjoxNDQ0NDkwLCJhY2NvdW50X2lkIjoxMjU2MDMsImV4cCI6MTcyOTAwNDYyMn0.7rPXLCgA2yI_Dz3K4Asl3ljxoDckVDgBM_nivHlujz4",
"refresh_token": "9ffaafdbb17607cac01a738e4936fb26"
}
Jobber getUsers
query GetUsers {
  users(first: 100) {
    nodes {
      id
      name {
        full
      }
    }
    totalCount
  }
}
}

Jobber update quote

mutation UpdateQuoteSalesperson($quoteId: ID!, $salesPersonId: ID!) {
  quoteUpdate(
    input: {
      id: $quoteId,
      salespersonId: $salesPersonId
    }
  ) {
    quote {
      id
      quoteNumber
      salesperson {
        name {
          full
        }
      }
    }
    userErrors {
      message
      path
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment