Everything was fine about line items in an invoice until now when I found it was not deleting all line items by providing an empty array in the Invoices.LineItems.
New line items are being added, existing line items are being updated or a single or more line items can be deleted as well. However, no changes to line items are made on Xero when passing an empty array in Invoices.LineItems. So how can we delete all the items from an invoice?
I have tested repeatedly by removing one item at a time and it gets deleted. The last item remains all the time.
The following screenshot was taken from Xero API Explorer after trying with a real invoice and a sample payload.
After struggling in Xero API Explorer and reviewing no-line invoices, I came to a solution to delete all line items successfully from an Invoice.
Passing an empty object as the first/single index of the array Invoices.LineItems does the job.
So instead of the following payload
{
"LineItems":[]
}
post the following payload to delete all line items from an invoice.
{
"LineItems":[{}]
}
However, to do that, I'll need to validate data and then remake the JSON body before submitting it to Xero. It's something, Xero should be the one doing that, by simply accepting the empty array [] for Invoices.LineItems and fulfilling the request of deleting all line items.
Or, if this behaviour of providing empty object in the array [{}] is intentional by Xero, it must be documented in the Xero API Reference. Because right now the third point of "Not providing an existing LineItem... deletes the line item" hints that simply an empty array [] would delete all line items, which is failing.
Related
I'm trying to use MS Graph to modify an event in my (Office 365) Outlook calendar such that it comes to have zero categories. Microsoft's "Update event" document doesn't seem to tell how I can do this.
Context:
I have an event with the "Foo" category already assigned.
Desired State:
For the event to have no category assigned at all.
What Has Worked:
I have successfully added a category to the event by specifying an array with a single string that is the display name of the category, like so:
URI: https://graph.microsoft.com/v1.0/me/calendar/events/<id>
Method: PATCH
Body:
{
"categories": ["Foo"]
}
What Hasn't Worked:
Setting "categories" to either an empty array ([]) or an array containing a single empty string ([""]) does not remove the category and does not return any error. Setting "categories" to null or [null] returns an error.
How can I modify an event to remove its category?
Using a Patch works okay for me
PATCH https://graph.microsoft.com/v1.0/me/events/AAMk...TTP/1.1
Host: graph.microsoft.com
{"categories":[]}
When you try this what do you see in the response ? are you seeing the categories set back to []. If you do but you don't see the change in the client it may just be related to sync time (eg Outlook in Cache mode etc).
Are you using any of the SDK's to do the update it maybe a bug or issue with those libraries when you have a null or empty value but you need to specify more what SDK or library your using.
I am trying to submit invoices to Quickbooks Online with line items.
Zapier does have line item support but only a handful of apps support it. The webhooks by Zapier is promising but so far I have tried a variety of tricks to enable line items without success.
If I send the invoice object as an array, it posts one invoice per line item.
If I send it as a nested JSON, ie this data:
{"billid":"MN001233","orgname":"My Org","generated_date":"10/01/2019","result_array":["Eligibility Details ,3244,0.1500,486.6000","Eligibility Pass through fee,11,0.0300,0.3300","Eligibility Pass through fee,36,0.0500,1.8000"]}
It treats the whole result_array as basically a string.
How can I send it so that multiple line items are supported in the same call?
I'm trying to fetch details from VSTS using VSTS query API. So to get all Portfolio Epics I created a custom query and used its ID to get that in JSON format. the query looks like this
https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/wiql/{id}?api-version=5.0-preview.2
But the issue is its not giving me many details about each of the work items in JSON. It only lists the ID and URL. Like this
WorkItems:[
{ID:234,URL:"workitemurl"},
{ID:235,URL:"workitemurl"},
{ID:236,URL:"workitemurl"},
...
]
So if I need more details about an item I need to execute those individual URl for each PE and thus I can get its details. instead of I am just checking is there is any way of getting an ID (keyedinID of each work item along with the ID and URL) like this. Please note KID is a field if we execute the URL separately. So to avoid that extra process, I would like to get that along with the WorkItems.
WorkItems:[
{ID:234,URL:"workitemurl",KID:002},
{ID:235,URL:"workitemurl",KID:023},
{ID:236,URL:"workitemurl",KID:033},
...
]
So how can we make this possible?
The Web UI uses a different API to get query results (/_api/_wit/_query), which allows query+data in a single pass. This is an old __v5 type call, which means it's considered internal.
The proper way to do this now is to first do the query as you're doing it right now and then call /_api/wit/workitems?ids=1,2,3,4 using the IDs from the references you got from the first call. That will also allow you to load the details dynamically and in small batches which will result in a more responsive UI.
See:
https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/list?view=azure-devops-rest-4.1
I'm looking to automate the generation of purchase orders (POs) in Quickbooks.
We're using the CData ADO.NET provider for Quickbooks (desktop), but since we're using ItemAggregate to add lines to POs, I'm not sure the specific adapter makes a difference.
For readability, our POs have blank rows between certain sections. I'm struggling to replicate this in ItemAggregate. I've tried:
adding <Row/> (QB ignores this)
adding <Row><ItemDescription/></Row> (QB ignores this)
as #2, but with a single space in the ItemDescription (QB ignores this)
as #2, but with a tab in the ItemDescription (QB ignores this)
as #2, but with in the ItemDescription (QB prints " ")
as #5, but change to a single space after saving the PO (causes an exception: "There was an error when modifying a PurchaseOrder. QuickBooks error message: You have no items or one or more of your amounts is not associated with an item. Please enter an item.")
Does anyone know of a programmatic way to get QB to add a blank line to a purchase order?
The CData ADO.NET Provider has been updated to support this functionality.
You will need to add a new hidden connection property to your connection string. Add PreserveAggregateWhitespace=true to your connection string. Now when you insert or update transactions, your XML elements will retain their whitespace:
<Row><ItemDescription> </ItemDescription></Row>
Your INSERT statement for a new SalesOrder could look like:
INSERT INTO
SalesOrders (CustomerName, ItemAggregate)
VALUES
('Doe, John','<SalesOrderLineItems><Row><ItemName>Repairs</ItemName><ItemQuantity>1</ItemQuantity></Row><Row><ItemDescription> </ItemDescription></Row><Row><ItemName>Removal</ItemName><ItemQuantity>2</ItemQuantity></Row></SalesOrderLineItems>')
Notice the blank space in the ItemDescription.
You can contact the CData Software Support Team if you need the updated build.
Say I make a work item in TFS. Then I make a change and update the text in the History tab (then save).
Using the TFS API, how can I get that text?
I would have thought it would have been in the History string for last item in the Revisions collection on the work item. (Because to set the string via the API you can use History on a normal work item.) However, in the Revisions array, all the work items are showing up as having History empty.
Any ideas on how I can get this string?
Check this blog post out: http://blogs.msdn.com/b/aaronbjork/archive/2011/01/10/programmatically-reading-work-item-comments.aspx
It’s a simple operation, but it might not be clear at first unless you discover that you need to loop through the collection of Revisions of the work item in order to view those comments.
You can get any of the basic tfs fields via aaronbjork's link and change it to use
Field f = r.Fields.TryGetById(1); or Field f = r.Fields["Title"]
title = 1
description = 52
the list of names and Ids is in the CoreField enumeration (only for non-custom fields)