I searched the forum but didn’t find anything related. Does the API support custom fields?
edit: Grammar
I searched the forum but didn’t find anything related. Does the API support custom fields?
edit: Grammar
Yes. It does support custom fields. What have you tried to do so far?
I used below code in power query. I was able to only get these default columns { “key”, “image”, “attachment”, “edit”, “view”, “date”, “paidFrom”, “receivedIn”, “description”, “amount” }
let
apiKey = "apikey here",
options = [Headers=[accept="application/json", #"X-API-KEY"=apiKey]],
response = Web.Contents("https://sth.manager.io/api2/payments?pageSize=1000&fields=", options),
jsonResponse = Json.Document(response),
#"Converted to Table" = Record.ToTable(jsonResponse),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each ([Name] = "payments")),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Name"}),
#"Expanded Value" = Table.ExpandListColumn(#"Removed Columns", "Value"),
#"Expanded Value1" = Table.ExpandRecordColumn(#"Expanded Value", "Value", {"key", "image", "attachment", "edit", "view", "date", "paidFrom", "receivedIn", "description", "amount"}, {"key", "image", "attachment", "edit", "view", "date", "paidFrom", "receivedIn", "description", "amount"}),
#"Expanded amount" = Table.ExpandRecordColumn(#"Expanded Value1", "amount", {"value", "currency"}, {"value", "currency"}),
#"Removed Columns1" = Table.RemoveColumns(#"Expanded amount",{"key", "image", "attachment", "edit", "view"}),
#"Multiplied Column" = Table.TransformColumns(#"Removed Columns1", {{"value", each _ * -1, type number}}),
#"Pivoted Column" = Table.Pivot(#"Multiplied Column", List.Distinct(#"Multiplied Column"[currency]), "currency", "value", List.Sum)
in
#"Pivoted Column"
I also tried JavaScript as below:
Side note: I noticed that the business name does not change in the API and keeps showing the original name.
edit: edited the image.
Good here, 24.5.16.1536
You did not illustrate how it supports custom fields.
Hi @lubos, could you illustrate how it supports custom fields? I’m waiting on my toes for this feature.
Let’s take a look at this ZatcaEGS Repository, you can see how to create/change Custom Fields, fill/replace the value of Custom Fields in transaction document via Api2.
I see you are trying to fetch data from Sales Tabs, for that you have to fetch Key from each data from /sales-invoices
, then read the data one by one from key /sales-invoice-form/{key}
.
Amazing thanks a lot that should do it for now. But I still think there should be a more efficient way to do this.