Cannot set SKU using Quickbooks API - quickbooks-online

I’m trying to create an item using the Quickbooks Online API, but the field Sku is just ignored. I send a body like this:
{
"TrackQtyOnHand": true,
"Name": "Garden Supplies",
"Sku": "ITEM-1",
"QtyOnHand": 10,
"IncomeAccountRef": {
"name": "Sales of Product Income",
"value": "79"
},
"AssetAccountRef": {
"name": "Inventory Asset",
"value": "81"
},
"InvStartDate": "2015-01-01",
"Type": "Inventory",
"ExpenseAccountRef": {
"name": "Cost of Goods Sold",
"value": "80"
}
}
However in the object I get back as response, the Sku field is not there.
I set the parameter minorVersion to 45 (which is something I was suggested to do), but still not working.

I think the problem is that the param minorVersion should actually be minorversion (all lowercase).

Related

Graph API User delta query not returning Manager following a change to the user

When I run this initial query:
https://graph.microsoft.com/beta/users/delta?$select=id,displayName,manager,jobTitle&$filter=id+eq+'87fa2ed7-5e58-4ff5-85ca-42a973e103e7'
I get the following response (as expected):
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#users(id,displayName,jobTitle,manager)",
"#odata.nextLink": "https://graph.microsoft.com/beta/users/delta?$skiptoken=<removed>",
"value": [
{
"displayName": "Jane Doe",
"jobTitle": "Super Administrator",
"id": "87fa2ed7-5e58-4ff5-85ca-42a973e103e7",
"manager#delta": [
{
"#odata.type": "#microsoft.graph.user",
"id": "1ab00b74-6f7e-45ca-8629-22d64632501d"
}
]
}
]
}
I follow the #odata.nextLink URL, which returns:
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#users",
"#odata.deltaLink": "https://graph.microsoft.com/beta/users/delta?$deltatoken=<removed>",
"value": []
}
I don't really understand why it doesn't just give me the deltaLink in the first call, but that isn't the issue. At this point, I make a change to the user's job title in Azure AD (outside of Graph API) and then follow the #odata.deltaLink, which returns:
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#users",
"#odata.deltaLink": "https://graph.microsoft.com/beta/users/delta?$deltatoken=<removed>",
"value": [
{
"displayName": "Jane Doe",
"jobTitle": "Administrator",
"id": "87fa2ed7-5e58-4ff5-85ca-42a973e103e7"
}
]
}
No manager!!
The only attribute changed was the job title; Manager is unchanged. This behavior is the same in both the v1.0 and beta endpoints. Also, I am not using the "prefer:return=minimal" header (or any additional headers for that matter).
Can anyone provide some insight into this?

Importing Facebook API data as JSON Object into Google Sheets results in mismatched Dates value

Goal: Import client data from Facebook Graph API into a Google Sheet to create a dynamic Facebook Ads Dashboard
What I've tried:
Downloaded Google Sheet script that includes an ImportJSON function which is meant to import a JSON feed and flatten it into a two-dimensional array ImportJSON
Used ImportJSON with a Graph API query created by Faceook's Graph API Explorer. That looks something like this:
/insights?date_preset=lifetime&time_increment=1&fields=account_currency,spend,frequency,reach,impressions,actions,cpm&use_account_attribution_setting=true&limit=5000
Result: Returns 2d-array in Google Sheet filled with the data we want. So far so good.
Problem: The dates are all off by one day (one day behind) for the values associated with query field "actions"
Query field "actions" returns an object with key "actions" and a value which is an array of objects whose keys and values correspond to different kinds of actions users are taking in response to our ads.
All of these are behind by one day.
My Investigation:
Google Sheets Output
"data": [
{
"account_currency": "USD",
"spend": "14.76",
"frequency": "1.263227",
"reach": "4593",
"impressions": "5802",
"cpm": "2.54395",
"actions": [
{
"action_type": "onsite_conversion.messaging_first_reply",
"value": "2"
},
{
"action_type": "onsite_conversion.view_content",
"value": "4"
},
{
"action_type": "onsite_conversion.messaging_conversation_started_7d",
"value": "19"
},
{
"action_type": "comment",
"value": "1"
},
{
"action_type": "link_click",
"value": "45"
},
{
"action_type": "offsite_conversion.fb_pixel_custom",
"value": "1"
},
{
"action_type": "offsite_conversion.fb_pixel_view_content",
"value": "1"
},
{
"action_type": "post",
"value": "5"
},
{
"action_type": "post_reaction",
"value": "25"
},
{
"action_type": "omni_view_content",
"value": "5"
},
{
"action_type": "page_engagement",
"value": "76"
},
{
"action_type": "post_engagement",
"value": "76"
},
{
"action_type": "view_content",
"value": "1"
}
],
"date_start": "2020-11-04",
"date_stop": "2020-11-04"
},
{
"account_currency": "USD",
"spend": "21.61",
"frequency": "1.249471",
"reach": "6145",
"impressions": "7678",
"cpm": "2.814535",
"actions": [
{
"action_type": "onsite_conversion.messaging_first_reply",
"value": "1"
},
{
"action_type": "onsite_conversion.messaging_conversation_started_7d",
"value": "13"
When I look at the sample of my JSON attached and compare it to the Google Sheets output, it looks to me like the "actions" keys and values are inheriting the "date_start" and "date_stop" values of the prior object and that is what is throwing my data off.
Question: Have I diagnosed this correctly? If so, how can ensure the "actions" are associated with the correct date?
Thanks for reading this. I hope my problem is described clearly.
I'm teaching myself this stuff so my vocabulary is probably a little shoddy!
The issue is that the library you're using is applying its default transformation function to the data https://github.com/bradjasper/ImportJSON/blob/master/ImportJSON.gs#L428 which in this case, won't transform the data in the way you want.
You would have to write your own transformation function to handle the specific shape of the expected data.

How to customize rest() route's description and id?

I configured Camel REST with Spring Boot and enabled actuator/camelroutes as in this example: https://github.com/apache/camel/blob/master/examples/camel-example-spring-boot/src/main/resources/application.properties
Now i am able to get my route descriptions... the problem is they are showing as route1,route2 etc, and provide no description which makes it difficult to distinguish which route belongs to which REST endpoint, e.g.
{
"id": "route2",
"uptime": "3.172 seconds",
"uptimeMillis": 3172,
"properties": {
"parent": "49889154",
"rest": "true",
"description": null,
"id": "route2"
},
"status": "Started"
}
Question is how do I provide custom description and id to rest() routes?
My route is simple:
rest("/hello")
.description("/hello GET endpoint")
.consumes("application/json").produces("text/html")
.get("/").description("Hello World example").outType(String.class)
.to("direct:hello")
and i tried adding .description after .rest("/bla") but it has no effect in the actuator/camelroutes
Ideally, i would like to get something like below:
{
"id": "route1",
"description": "direct hello route returning simple string",
"uptime": "3.173 seconds",
"uptimeMillis": 3173,
"properties": {
"parent": "76af51d6",
"rest": "false",
"description": "direct hello route returning simple string",
"id": "route1"
},
"status": "Started"
},
You need to set id and description to route context, not to rest context.
For example this definition:
rest("/hello")
.consumes("application/json").produces("text/html")
.get("/").outType(String.class)
.route().id("sayHi").description("This endpoint says Hi")
.to("direct:hello");
from("direct:hello")
.routeId("hello")
.setBody(constant("Hi"));
Generates this actuator output:
[
{
"id": "hello",
"uptime": "13.158 seconds",
"uptimeMillis": 13158,
"status": "Started"
},
{
"id": "sayHi",
"description": "This endpoint says Hi",
"uptime": "13.145 seconds",
"uptimeMillis": 13145,
"status": "Started"
}
]

Docusign REST API MERGE FIELD - SALESFORCE

Im trying to prefill my document with salesforcse Lead Name, however i cant accomplish it, the signHereTabs, and dateSignedTab is showing but the
texttabs dont get any data,
The REST API Documentation https://docs.docusign.com/esign/restapi/CustomTabs/CustomTabs/create/#request
says: that the row field is the "Specifies the row number in a Salesforce table that the merge field value corresponds to." but if i pass the salesforce record id im getting the error:
DocuSign Response{
"errorCode": "INVALID_REQUEST_PARAMETER",
"message": "The request contained at least one invalid parameter. int value expected for parameter: mergeField.row"
}
This is my json request:
{
"emailSubject": "Agreement",
"emailBlurb": "MSTSolutions is sending you this request for your electronic signature and enter or update confidential payment information.Please review and electronically sign by following the link below.",
"templateId": "42a4815d-f8ac-4972-b1ea-2e1534324658",
"envelopeIdStamping": "false",
"templateRoles": [{
"roleName": "Signer 1",
"name": "TEST TEST",
"email": "xxx#xxxx.com",
"recipientId": "1",
"tabs": {
"signHereTabs": [{
"xPosition": "25",
"yPosition": "50",
"documentId": "1",
"pageNumber": "1"
}],
"dateSignedTabs": [{
"name": "Date Signed",
"xPosition": "25",
"yPosition": "100",
"documentId": "1",
"pageNumber": "1"
}],
"textTabs": [{
"tabLabel": "LeadFirstName",
"xPosition": "25",
"yPosition": "200",
"documentId": "1",
"pageNumber": "1",
"mergeField": {
"configurationType":"Salesforce",
"path":"Lead",
"row":"00Q29000003fI13",
"writeback":"true",
"allowSenderToEdit":"true",
}
}]
}
}],
"status": "sent"
}
Thanks
Fairly sure the error is is how your path is configured. Try this:
"path": "Lead.FirstName"
and then remove the "Row" line
If you use the 'GET /v2/accounts/{accountId}/envelopes' create endpoint you can pass in the lead/opportunity/account Ids via the "Custom Fields" section. This will set all custom Salesforce fields you have defined in the template (relating to the SFIDs you provide) without having to set each tab one by one.
"customFields":{
"textCustomFields":[
{
"value":"0060n00000DIvfNAAT",
"name":"Opportunity",
"configurationType":"salesforce"
}
]
}
Note the textCustomFields is enclosed in a customFields block (which matches the published API) and most importantly, the configuration type must be set to "salesforce" and the Name must be "Opportunity" (etc) without the ##SF prefix which appears in a lot of examples on the web (for the SOAP api). By examining the 'GET /v2/accounts/{accountId}/envelopes/{envelopeId}/custom_fields' endpoint you can see that the API is automatically afixing the ##SF prefix and modifying the Value to include the record name:
{
"textCustomFields": [
{
"fieldId": "10140751586",
"name": "##SFOpportunity",
"show": "false",
"required": "false",
"value": "0060n00000DIvfNAAT~Test Opp Lisa Simpson"
}
}

Why is angularjs code slow?

Is it normal, that angularjs ng-repeat takes 1.5 Seconds to render data from an rest api? The result consists of only 10 rows with in total 1KB of data. How can I improve the speed or where to look for the problem?
ADDED INFOS:
The rest request itself only takes 128ms if I run it directly on the browser.
This is a set of sample data you get from the rest api:
{
"result": [
{
"id": 1224,
"name": "Schokolade-Vanille",
"kcal": 35500,
"displayName": "Schokolade-Vanille"
},
{
"id": 23423,
"name": "Naturreis Uncle Bens",
"kcal": 34400,
"displayName": "Naturreis Uncle Bens"
},
{
"id": 123231,
"name": "Paprikahendl",
"kcal": 4100,
"displayName": "Paprikahendl"
},
{
"id": 434,
"name": "Vanille Kugeln",
"kcal": 53700,
"displayName": "Vanille Kugeln"
},
{
"id": 323423,
"name": "Weihnachtstraum, Lindor-Kugeln",
"kcal": 60800,
"displayName": "Lindor-Kugeln"
},
{
"id": 5435,
"name": "Schokolade",
"kcal": 4300,
"displayName": "Schokolade"
},
{
"id": 23213,
"name": "Hühner-Nuggets",
"kcal": 23400,
"displayName": "Hühner-Nuggets"
},
{
"id": 5534,
"name": "Knödel, Kartoffel",
"kcal": 1230,
"displayName": "Knödel, Kartoffel"
},
{
"id": 23233,
"name": "Curvers",
"kcal": 15400,
"displayName": "Curvers"
},
{
"id": 53434,
"name": "Frites Original",
"kcal": 14100,
"displayName": "Frites Original"
}
],
"count": 12854
}
NEW ADDED INFOS
I have had a closer look now and found out, that not te repeat funktion is the problem.
I used the following code:
$scope.updateResultset = function() {
$scope.result = Food.query({
offset: $scope.offset,
order_by: $scope.orderby,
name: $scope.textfilter,
},function(){
console.log( "response " + (new Date().getTime() - start) );
});
$scope.offset = undefined;
console.log( "updateResultset " + (new Date().getTime() - start) );start = new Date().getTime();
And get the following response:
response 435
But the request itself only takes 131ms. In my opinion, >300ms is a lot of time to waste in a single method?
Compared to my former version, where I showed a plan html list, which was replaced by jquery ajax response html, its much slower?
As others indicated in the comments, the cause in the code is likely something else aside from ng-repeat. However, here are other options to consider, if speed still seems like an issue for ng-repeat:
quick-ng-repeat directive on github: https://github.com/allaud/quick-ng-repeat
ng-scroll, as part of angular-ui: https://github.com/angular-ui/ui-utils/blob/master/modules/scroll/README.md
Ok, I found out the problem. Not the repeatition of the 10 list items was the problem! As you can see in my question, I return not only the 10 results, but also the total amount of results. In my case it was '"count": 12854'.
On the same page, I have a pagination which was the part which slows down the whole page, since it had to render 1286 pager buttons (~12854/10). Now I only show 10 pager-buttons.

Resources