Jump to content

Norman Firkins

Members
  • Posts

    16
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I'm using the product endpoint to create a product in my Sage BCA account. Here is my request payload: {'product': {'description': 'Example Product', 'sales_ledger_account_id': 'k6d41a1c29b11ea8d3c022ace18d9e2', 'purchase_ledger_account_id': 'd7fh34o1c29b11ea8d3c022aced7f78e', 'item_code': '123456', 'active': true}} I'm getting a 422 code error with the following message: [{'$severity': 'error', '$dataCode': 'SecureValidationError', '$message': 'Saving Non-stock failed: value of purchase_ledger_account was not allowed.', '$source': 'purchase_ledger_account'}] The purchase ledger account ID is correct as I use the ledger endpoint to get the ID for my purchase ledger account from my account. Any ideas why this could be happening, Cheers
  2. Hi, I'm using the product endpoint to create a product in my Sage BCA account. Here is my request payload: {'product': {'description': 'Example Product', 'sales_ledger_account_id': 'k6d41a1c29b11ea8d3c022ace18d9e2', 'purchase_ledger_account_id': 'd7fh34o1c29b11ea8d3c022aced7f78e', 'item_code': '123456', 'active': true}} I'm getting a 422 code error with the following message: [{'$severity': 'error', '$dataCode': 'SecureValidationError', '$message': 'Saving Non-stock failed: value of purchase_ledger_account was not allowed.', '$source': 'purchase_ledger_account'}] The purchase ledger account ID is correct as I use the ledger endpoint to get the ID for my purchase ledger account from my account. Any ideas why this could be happening, Cheers
  3. The in house software we use your API synchronises our orders from our eBay platform to Sage. We've been having this problem I would say since the start of March, but at the same time the eBay API that we use also had faults with it that caused errors in the software. So both of the APIs could have been causing faults at the same time. So it is hard to tell if the issue with the Sage API started then as well. But just to be safe I'd say the start of March. Cheers
  4. Hi Mark, Here is the body of the request: {'sales_invoice': {'contact_id': '3b0cdd0d9b954e90af637fd2d900g2y6', 'date': '2023-05-01', 'due_date': '2023-05-01', 'reference': '1234', 'invoice_lines': [{'description': 'Some Product Title', 'ledger_account_id': '1d1241a1c29b11ea8d3c022ace1a54s2', 'unit_price': 4.16, 'product_id': 'be54cd46cda24132abb4534fc1f66532', 'quantity': 3.0, 'tax_rate_id': 'GB_STANDARD', 'tax_amount': 2.49}, {'description': 'Postage', 'ledger_account_id': '1d1241a1c29b11ea8d3c022ace1a54s2', 'unit_price': 0.0, 'product_id': 'a38ef5c4751c469b8101c0c02112we34', 'quantity': 1.0, 'tax_rate_id': 'GB_STANDARD', 'tax_amount': 0.0}, {'description': 'Rounding adjustment', 'ledger_account_id': '1d1241a1c29b11ea8d3c022ace1a32ew', 'unit_price': -2.25, 'quantity': 1.0, 'tax_rate_id': 'GB_STANDARD'}], 'status_id': 'PAID'}} I've changed some values for privacy reasons etc. This body has worked for the last year and a half for us and now it's all of a sudden throwing the said error. Thanks
  5. Hi, This is an error I haven't come across before. I am calling the /sales_invoice endpoint and providing all of the required data, plus a few extra bits of information. When I submit the request to the POST sales_invoice endpoint I get this error: [{'$severity': 'error', '$dataCode': 'RecordInvalid', '$message': 'This field is required.', '$source': 'line_items.currency_tax_amount'}] I didn't this the currency_tax_amount was a required field. I haven't had this issue before and have been able to create invoices perfectly fine in the past. Any ideas on how to fix this?
  6. I have recently change the callback url of my app. However, when I load the authorisation link to login to Sage, the page does not redirect to the callback url, it presents me with a page that states I have hit an Application Authorisation Error. I have double checked that the callback url works by just loading it on the web browser and it works. Does it take a certain amount of time for details such as the callback url to update across the Sage API network? I have tried other URLs that I know work, but the only one that works is the one I had before I changed it. Any ideas on what this could be? Thank you
  7. Hi there, I am making a call to the Return a Product with the product_id. Here is my request: url = 'https://api.accounting.sage.com/v3.1/products/'+ product_id headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + access_token, } response = requests.request("GET", url, headers=headers) But I am not getting any of the attributes associated with the product. All I am getting is the product_id, the description and the $path. Here is the response I get: {'id': 'a61e87u65p98efef9', 'displayed_as': 'product description example', '$path': '/products/a61e87u65p98efef9'} I want to be able to get the item_code of the product, but on the API reference it says that the response should include the item_code, however it isn't. Any ideas on how I can get this attribute, Thank you
  8. @Steel, Mark Thanks Mark thats great. I'm having trouble with searching for a sales invoice by reference. Here's my code, am I doing anything wrong? Thank you url = 'https://api.accounting.sage.com/v3.1/sales_invoices?search=' + reference + ',status_id=paid' headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + access_token, } response = requests.request("GET", url, headers=headers)
  9. @Steel, Mark Just a quick question with creating a Contact Payment, where can I find the transaction_type_id? Thank you
  10. @Steel, Mark So I'm assuming I would have to create a contact payment which is associated with a bank account and the artefact(sales invoices), then the invoice will be displayed as paid? Thank you for the help
  11. Hi there, Just wondering how I can set the status_id of an invoice when I create it. At the moment when I create an invoice, they automatically are set as overdue. Here is my code, if you have any ideas they would be much appreciated url = 'https://api.accounting.sage.com/v3.1/sales_invoices' payload = { "sales_invoice": { "contact_id": contact_id, "date": date, "due_date": date, "reference": reference, "invoice_lines": products, "status_id": 'PAID' } } headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + access_token, } response = requests.request("POST", url, headers=headers, json=payload) Thank you
  12. @Steel, Mark I thought it was working, but I have left it for about 4 hours now and have ran my program again and the problem is still there. Refresh tokens are valid for 31 days aren't they? So why would it be saying that a token is invalid? Also my token is stored in a variable, that takes the refresh token directly from the JSON response
  13. Hi @Steel, Mark, I'm exchanging refresh_tokens for every request. I added the accept parameter to the header and it works, thank you so much. I don't believe that was in the documentation though for Authorization? It would be helpful to have that in the documentation, especially for newbies to the Accounting API, as I was following the documentation strictly. Or does the documentation just assume that you know to put that in the header? Thanks again.
  14. Hi there, My OAuth2.0 code has been working fine, but today I have received this from my API: {'error': 'invalid_grant', 'error_description': 'the submitted refresh_token is invalid'}. The refresh token had been minted a few minutes before from a sign in via Sage to authorize my app, so I doubt that my refresh token has expired. Any ideas on what the problem could be? Here is my code to make sure I've followed the documentation correctly; url = 'https://oauth.accounting.sage.com/token' payload = {'grant_type': 'refresh_token', 'refresh_token': refreshtoken, 'client_id': client_id, 'client_secret': client_secret } headers = { 'Content-Type': 'application/x-www-form-urlencoded' } response = requests.request("POST", url, headers=headers, data=payload) Thank you any help would be great
  15. Hi Ben, Yes I have already gained an authorization code successfully, and I passed it with the request for an access token. I got the code from the url that was returned from the successful sign in to sage. I am still getting an issue with the format of the code. Thank you
×
×
  • Create New...