Related
I need to have service that return the history of task potential owner.
An example: A task is assigned to group IT, after 2 date the task is assigned to group PM.
Is There a service that return this type of information?
The service rest/server/containers/{contaioner-id}/tasks/{task}/events seems not return this type of information, it return only the history of users that have claimed the task
Example:
{
"task-event-instance": [
{
"task-event-id": 596,
"task-id": 596,
"task-event-type": "ADDED",
"task-event-user": "Test.Test",
"task-event-date": {
"java.util.Date": 1662126409212
},
"task-process-instance-id": 7404,
"task-work-item-id": 7504,
"task-event-message": null
},
{
"task-event-id": 596,
"task-id": 596,
"task-event-type": "DELEGATED",
"task-event-user": "unknown",
"task-event-date": {
"java.util.Date": 1662126589217
},
"task-process-instance-id": 7404,
"task-work-item-id": 7504,
"task-event-message": null
},
{
"task-event-id": 596,
"task-id": 596,
"task-event-type": "STARTED",
"task-event-user": "USER1",
"task-event-date": {
"java.util.Date": 1662372161496
},
"task-process-instance-id": 7404,
"task-work-item-id": 7504,
"task-event-message": null
},
{
"task-event-id": 596,
"task-id": 596,
"task-event-type": "DELEGATED",
"task-event-user": "unknown",
"task-event-date": {
"java.util.Date": 1662372497200
},
"task-process-instance-id": 7404,
"task-work-item-id": 7504,
"task-event-message": null
}
]
So far I have created the following nodes:
CREATE
(b:Brand {identifier: 'ANTIINFECTIEUX',brand:'ANTIINFECTIEUX',description :'ANTIINFECTIEUX' }),
(b)<-[:IS_A_CATALOG_BELONGING_TO]-(c:Catalog {identifier: 'ANTIBACTERIENS',catalogName:'ANTIBACTERIENS',brand:'ANTIINFECTIEUX',brandIdentifier:'ANTIINFECTIEUX',description :'ANTIBACTERIENS'}),
(c)<-[:IS_A_PRODUCT_BELONGING_TO_THAT_CATALOG]-(p:Product {identifier: 'Amikacine',productName:'Amikacine',brand:'ANTIINFECTIEUX',brandIdentifier:'ANTIINFECTIEUX',catalog:'ANTIBACTERIENS',catalogIdentifier:'ANTIBACTERIENS',description :'Amikacine',DCI:'Amikacine', Dosage:'1g', Forme:'Inj', Case:'false', Poste:'false', CTRE:'false', CHR:'true', CHN:'true', Reference:'Amiklin', price:'200.75', stock:'500',NumeroDeLot:'87',CodeBarre:'87878787878787878',QuantiteDemandee:'50'}),
(p)-[:IS_A_PRODUCT_BELONGING_TO_THAT_BRAND]->(b),
(c)<-[:IS_A_PRODUCT_BELONGING_TO_THAT_CATALOG]-(p2:Product {identifier: 'Amoxicilline',productName:'Amoxicilline',brand:'ANTIINFECTIEUX',brandIdentifier:'ANTIINFECTIEUX',catalog:'ANTIBACTERIENS',catalogIdentifier:'ANTIBACTERIENS',description :'Amoxicilline',DCI:'Amoxicilline', Dosage:'500mg', Forme:'Gélules', Case:'false', Poste:'true', CTRE:'true', CHR:'true', CHN:'true', Reference:'Clamoxyl', price:'250.75', stock:'700',NumeroDeLot:'8777',CodeBarre:'998898979797',QuantiteDemandee:'50'}),
(p2)-[:IS_A_PRODUCT_BELONGING_TO_THAT_BRAND]->(b),
(b1:Brand {identifier: 'ANESTHESIQUES',brand:'ANESTHESIQUES',description :'ANESTHESIQUES' }),
(b1)<-[:IS_A_CATALOG_BELONGING_TO]-(c1:Catalog {identifier: 'Anesthesiques_Generaux_et_Gaz_medicaux',catalogName:'Anesthesiques_Generaux_et_Gaz_medicaux',brand:'ANESTHESIQUES',brandIdentifier:'ANESTHESIQUES',description :'Anesthésiques généraux et Gaz médicaux'}),
(c1)<-[:IS_A_PRODUCT_BELONGING_TO_THAT_CATALOG]-(p1:Product {identifier: 'Kétamine',productName:'Kétamine',brand:'ANESTHESIQUES',brandIdentifier:'ANESTHESIQUES',catalog:'Anesthesiques_Generaux_et_Gaz_medicaux',catalogIdentifier:'Anesthesiques_Generaux_et_Gaz_medicaux',description :'Kétamine',DCI:'Kétamine', Dosage:'50mg/amp', Forme:'Inj', Case:'false', Poste:'false', CTRE:'true', CHR:'true', CHN:'true', Reference:'Kétalar', price:'900.75', stock:'300',NumeroDeLot:'677',CodeBarre:'5454578788',QuantiteDemandee:'10'}),
(p1)-[:IS_A_PRODUCT_BELONGING_TO_THAT_BRAND]->(b1)
The purpose is to get a nested json like this:
{
"menuItems":[
{
"name":"Anesthesiques_Generaux_et_Gaz_medicaux",
"children":[
{
"name":"ANESTHESIQUES",
"children":[
{
"name":"Kétamine",
"ProductCHR":"true",
"ProductForme":"Inj",
"ProductCHN":"true",
"ProductReference":"Kétalar",
"ProductDCI":"Kétamine",
"ProductCase":"false",
"ProductDosage":"50mg/amp",
"ProductIdentifier":"Kétamine",
"ProductPoste":"false",
"ProductPrice":"900.75",
"ProductCTRE":"true",
"ProductStock":"300"
}
]
}
]
},
{
"name":"ANTIBACTERIENS",
"children":[
{
"name":"ANTIINFECTIEUX",
"children":[
{
"name":"Amikacine",
"ProductCHR":"true",
"ProductForme":"Inj",
"ProductCHN":"true",
"ProductReference":"Amiklin",
"ProductDCI":"Amikacine",
"ProductCase":"false",
"ProductDosage":"1g",
"ProductIdentifier":"Amikacine",
"ProductPoste":"false",
"ProductPrice":"200.75",
"ProductCTRE":"false",
"ProductStock":"500"
},
{
"name":"Amoxicilline",
"ProductCHR":"true",
"ProductForme":"Gélules",
"ProductCHN":"true",
"ProductReference":"Clamoxyl",
"ProductDCI":"Amoxicilline",
"ProductCase":"false",
"ProductDosage":"500mg",
"ProductIdentifier":"Amoxicilline",
"ProductPoste":"true",
"ProductPrice":"250.75",
"ProductCTRE":"true",
"ProductStock":"700"
}
]
}
]
}
]
}
To generate that JSON file I've made the following cypher request:
MATCH (Brand:Brand)
OPTIONAL MATCH (Brand)<-[:IS_A_CATALOG_BELONGING_TO]-(Catalog:Catalog)
OPTIONAL MATCH (Catalog)<-[:IS_A_PRODUCT_BELONGING_TO_THAT_CATALOG]-(Product:Product)
OPTIONAL MATCH (Product)-[:IS_A_PRODUCT_BELONGING_TO_THAT_BRAND]->(Brand)
WITH Brand, Catalog, Product
ORDER BY Product.identifier ASC
WITH Brand, Catalog,
collect({name: Product.DCI, ProductIdentifier:Product.identifier,ProductDCI:Product.DCI,
ProductDosage:Product.Dosage,ProductForme:Product.Forme,ProductCase:Product.Case,
ProductPoste:Product.Poste,ProductCTRE:Product.CTRE,ProductCHR:Product.CHR,ProductCHN:Product.CHN,
ProductReference:Product.Reference,ProductPrice:Product.price,ProductStock:Product.stock,
NumeroDeLot:Product.NumeroDeLot,CodeBarre:Product.CodeBarre,QuantiteDemandee:Product.QuantiteDemandee}) AS pNames
ORDER BY Catalog.identifier ASC
WITH Brand.identifier AS name,
collect(Catalog.identifier ) AS cname,
collect( pNames) AS children
ORDER BY name ASC
RETURN apoc.convert.toJson({name:name,cname:cname,children:children})
That request holds all infos need but
Unfortunately, the ideal output form it doesn't match my expectations (the resultant json that I really want) as you can see here.
"{
"children":[
[
{
"NumeroDeLot":"677",
"ProductReference":"Kétalar",
"ProductCase":"false",
"ProductPrice":"900.75",
"ProductCTRE":"true",
"QuantiteDemandee":"10",
"ProductCHR":"true",
"ProductForme":"Inj",
"ProductCHN":"true",
"ProductDCI":"Kétamine",
"ProductDosage":"50mg/amp",
"ProductIdentifier":"Kétamine",
"name":"Kétamine",
"ProductPoste":"false",
"CodeBarre":"5454578788",
"ProductStock":"300"}
]
],
"name":"ANESTHESIQUES",
"cname":["Anesthesiques_Generaux_et_Gaz_medicaux"]
}
"
"{
"children":[
[
{
"NumeroDeLot":"87",
"ProductReference":"Amiklin",
"ProductCase":"false",
"ProductPrice":"200.75",
"ProductCTRE":"false",
"QuantiteDemandee":"50",
"ProductCHR":"true",
"ProductForme":"Inj",
"ProductCHN":"true",
"ProductDCI":"Amikacine",
"ProductDosage":"1g",
"ProductIdentifier":"Amikacine",
"name":"Amikacine",
"ProductPoste":"false",
"CodeBarre":"87878787878787878",
"ProductStock":"500"
},
{
"NumeroDeLot":"8777",
"ProductReference":"Clamoxyl",
"ProductCase":"false",
"ProductPrice":"250.75",
"ProductCTRE":"true",
"QuantiteDemandee":"50",
"ProductCHR":"true",
"ProductForme":"Gélules",
"ProductCHN":"true",
"ProductDCI":"Amoxicilline",
"ProductDosage":"500mg",
"ProductIdentifier":"Amoxicilline",
"name":"Amoxicilline",
"ProductPoste":"true",
"CodeBarre":"998898979797",
"ProductStock":"700"
}
]
],
"name":"ANTIINFECTIEUX",
"cname":["ANTIBACTERIENS"]
}"
It would be great if someone could help me to achieve that purpose.
{
"menuItems":[
{
"name":"Brand Name1",
"children":[
{
"name":"Catalog Name",
"children":[
{
"name": "productName1",
.....................
etc
},
{
"name": "productName2"
.....................
},
........................
{
"name": "productNameN"
.....................
}
]
},
......................................
{
"name":"Catalog NameN",
"children":[
{
"name": "productName1ForCatalogNameN",
.....................
etc
},
{
"name": "productName2ForCatalogNameN"
.....................
},
........................
{
"name": "productNameNForCatalogNameN"
.....................
}
]
},
]
},
....................................................................
{
"name":"Brand NameN",
"children":[
{
"name":"Catalog Name",
"children":[
{
"name": "productName1",
.....................
etc
},
{
"name": "productName2"
.....................
},
........................
{
"name": "productNameN"
.....................
}
]
},
......................................
{
"name":"Catalog NameN",
"children":[
{
"name": "productName1ForCatalogNameN",
.....................
etc
},
{
"name": "productName2ForCatalogNameN"
.....................
},
........................
{
"name": "productNameNForCatalogNameN"
.....................
}
]
},
]
}
]
}
Many thanks.
CREATE
(b:Brand {name: 'ANTIINFECTIEUX',brand:'ANTIINFECTIEUX',description :'ANTIINFECTIEUX' }),
(b)<-[:IS_A_CATALOG_BELONGING_TO]-(c:Catalog {name: 'ANTIBACTERIENS',catalogName:'ANTIBACTERIENS',brand:'ANTIINFECTIEUX',brandIdentifier:'ANTIINFECTIEUX',description :'ANTIBACTERIENS'}),
(c)<-[:IS_A_PRODUCT_BELONGING_TO_THAT_CATALOG]-(p:Product {name: 'Amikacine',productName:'Amikacine',brand:'ANTIINFECTIEUX',brandIdentifier:'ANTIINFECTIEUX',catalog:'ANTIBACTERIENS',catalogIdentifier:'ANTIBACTERIENS',description :'Amikacine',DCI:'Amikacine', Dosage:'1g', Forme:'Inj', Case:'false', Poste:'false', CTRE:'false', CHR:'true', CHN:'true', Reference:'Amiklin', price:'200.75', stock:'500',NumeroDeLot:'87',CodeBarre:'87878787878787878',QuantiteDemandee:'50'}),
(p)-[:IS_A_PRODUCT_BELONGING_TO_THAT_BRAND]->(b),
(c)<-[:IS_A_PRODUCT_BELONGING_TO_THAT_CATALOG]-(p2:Product {name: 'Amoxicilline',productName:'Amoxicilline',brand:'ANTIINFECTIEUX',brandIdentifier:'ANTIINFECTIEUX',catalog:'ANTIBACTERIENS',catalogIdentifier:'ANTIBACTERIENS',description :'Amoxicilline',DCI:'Amoxicilline', Dosage:'500mg', Forme:'Gélules', Case:'false', Poste:'true', CTRE:'true', CHR:'true', CHN:'true', Reference:'Clamoxyl', price:'250.75', stock:'700',NumeroDeLot:'8777',CodeBarre:'998898979797',QuantiteDemandee:'50'}),
(p2)-[:IS_A_PRODUCT_BELONGING_TO_THAT_BRAND]->(b),
(b1:Brand {name: 'ANESTHESIQUES',brand:'ANESTHESIQUES',description :'ANESTHESIQUES' }),
(b1)<-[:IS_A_CATALOG_BELONGING_TO]-(c1:Catalog {name: 'Anesthesiques_Generaux_et_Gaz_medicaux',catalogName:'Anesthesiques_Generaux_et_Gaz_medicaux',brand:'ANESTHESIQUES',brandIdentifier:'ANESTHESIQUES',description :'Anesthésiques généraux et Gaz médicaux'}),
(c1)<-[:IS_A_PRODUCT_BELONGING_TO_THAT_CATALOG]-(p1:Product {name: 'Kétamine',productName:'Kétamine',brand:'ANESTHESIQUES',brandIdentifier:'ANESTHESIQUES',catalog:'Anesthesiques_Generaux_et_Gaz_medicaux',catalogIdentifier:'Anesthesiques_Generaux_et_Gaz_medicaux',description :'Kétamine',DCI:'Kétamine', Dosage:'50mg/amp', Forme:'Inj', Case:'false', Poste:'false', CTRE:'true', CHR:'true', CHN:'true', Reference:'Kétalar', price:'900.75', stock:'300',NumeroDeLot:'677',CodeBarre:'5454578788',QuantiteDemandee:'10'}),
(p1)-[:IS_A_PRODUCT_BELONGING_TO_THAT_BRAND]->(b1)
The request that fulfilled my needs
MATCH PATH = (Brand:Brand)<-[*]-(Catalog:Catalog)<-[*]-(Product:Product)
with collect(PATH) as paths
call apoc.convert.toTree(paths) yield value
return value
From neo4j 3.5.0 + and up the signature of apoc.convert.toTree
we could include/exclude properties,relationships and as has 3 arguments
[paths],[lowerCaseRels=true]) | creates a stream of nested documents representing the at least one root of these paths
like in the below
To exclude we prefix with -
apoc.convert.toTree(ps, true,{nodes: {Catalog: ['-name']},
relationships: {subcategory:['-id']}})
To include
apoc.convert.toTree(ps, true,{nodes: {Catalog: ['name']},
relationships: {subcategory:['id']}})
but Unfortunately there is no way to remove _id _type from cypher result See that link [https://stackoverflow.com/questions/56288402/is-there-a-way-to-remove-id-type-from-cypher-result]1
I'm trying to get all the eventMessages that belongs to a specific event. However I'm not being able to.
I'm querying the me/messages with the $expand=microsoft.graph.eventMessage/event and trying to filter on this relationship:
https://graph.microsoft.com/v1.0/me/messages?$expand=microsoft.graph.eventMessage/event&filter=event/id eq 'eventID'
However, I'm getting the following error
{
"error": {
"code": "RequestBroker--ParseUri",
"message": "Could not find a property named 'event' on type 'Microsoft.OutlookServices.Message'.",
"innerError": {
"request-id": "cb211061-802b-4657-a191-f06c449897d1",
"date": "2019-05-16T14:01:43"
}
}
}
But looking at their example of expanding the message with the event, there is an event property on the return of the API (see returned JSON below).
HTTP/1.1 200 OK
Content-type: application/json
{
"#odata.context":"https://graph.microsoft.com/v1.0/$metadata#users('8fd6e83b-3cc0-4bf0-8b26-950f4d7110f6')/messages/$entity",
"#odata.type":"#microsoft.graph.eventMessage",
"#odata.etag":"W/\"CwAAABYAAABXlB/SL0N4Q6g6o+jSYAEuAAAImkVF\"",
"id":"AAMkADYAAAImV_jAAA=",
"createdDateTime":"2017-12-27T21:54:55Z",
"lastModifiedDateTime":"2017-12-27T23:26:38Z",
"changeKey":"CwAAABYAAABXlB/SL0N4Q6g6o+jSYAEuAAAImkVF",
"categories":[
],
"receivedDateTime":"2017-12-27T21:54:55Z",
"sentDateTime":"2017-12-27T21:54:54Z",
"hasAttachments":false,
"internetMessageId":"<MWHPR1301MB211042CF#MWHPR1301MB2110.namprd13.prod.outlook.com>",
"subject":"Kick off planning",
"bodyPreview":"Let's collect opinions from our teams and organize action items.",
"importance":"normal",
"parentFolderId":"AQMkADYAS4AAAIBDAAAAA==",
"conversationId":"AAQkADYRuffB3wDlPn-ReFZarI60=",
"isDeliveryReceiptRequested":null,
"isReadReceiptRequested":false,
"isRead":false,
"isDraft":false,
"webLink":"https://outlook.office365.com/owa/?ItemID=AAMkADYAAAImV%2BjAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification":"focused",
"meetingMessageType":"meetingRequest",
"body":{
"contentType":"html",
"content":"<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n<style type=\"text/css\" style=\"display:none\">\r\n<!--\r\np\r\n\t{margin-top:0;\r\n\tmargin-bottom:0}\r\n-->\r\n</style>\r\n</head>\r\n<body dir=\"ltr\">\r\n<div id=\"divtagdefaultwrapper\" dir=\"ltr\" style=\"font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif\">\r\n<p style=\"margin-top:0; margin-bottom:0\">Let's collect opinions from our teams and organize action items.<br>\r\n</p>\r\n</div>\r\n</body>\r\n</html>\r\n"
},
"sender":{
"emailAddress":{
"name":"Administrator",
"address":"admin#contoso.onmicrosoft.com"
}
},
"from":{
"emailAddress":{
"name":"Administrator",
"address":"admin#contoso.onmicrosoft.com"
}
},
"toRecipients":[
{
"emailAddress":{
"name":"Alex Wilber",
"address":"AlexW#contoso.onmicrosoft.com"
}
}
],
"ccRecipients":[
],
"bccRecipients":[
],
"replyTo":[
],
"event#odata.context":"https://graph.microsoft.com/v1.0/$metadata#users('8fd6e83b-3cc0-4bf0-8b26-950f4d7110f6')/messages('AAMkADYAAAImV_jAAA%3D')/microsoft.graph.eventMessage/event/$entity",
"event":{
"#odata.etag":"W/\"V5Qf0i9DeEOoOqPo0mABLgAACJpBWg==\"",
"id":"AAMkADYAAAImVu6AAA=",
"createdDateTime":"2017-12-27T21:54:55.2624551Z",
"lastModifiedDateTime":"2017-12-27T22:19:16.6667889Z",
"changeKey":"V5Qf0i9DeEOoOqPo0mABLgAACJpBWg==",
"categories":[
],
"originalStartTimeZone":"Pacific Standard Time",
"originalEndTimeZone":"Pacific Standard Time",
"iCalUId":"040000008200E00074C5B7101A82E00800000000A2A6F3535D7FD3010000000000000000100000003D770E2E8974F44B9471BDB348097FE3",
"reminderMinutesBeforeStart":15,
"isReminderOn":true,
"hasAttachments":false,
"subject":"Kick off planning",
"bodyPreview":"Let's collect opinions from our teams and organize action items.",
"importance":"normal",
"sensitivity":"normal",
"isAllDay":false,
"isCancelled":false,
"isOrganizer":false,
"responseRequested":true,
"seriesMasterId":null,
"showAs":"tentative",
"type":"singleInstance",
"webLink":"https://outlook.office365.com/owa/?itemid=AAMkADYAAAImVu6AAA%3D&exvsurl=1&path=/calendar/item",
"onlineMeetingUrl":null,
"responseStatus":{
"response":"tentativelyAccepted",
"time":"2017-12-27T22:19:12.6197462Z"
},
"body":{
"contentType":"html",
"content":"<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n<style type=\"text/css\" style=\"display:none\">\r\n<!--\r\np\r\n\t{margin-top:0;\r\n\tmargin-bottom:0}\r\n-->\r\n</style>\r\n</head>\r\n<body dir=\"ltr\">\r\n<div id=\"divtagdefaultwrapper\" dir=\"ltr\" style=\"font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif\">\r\n<p style=\"margin-top:0; margin-bottom:0\">Let's collect opinions from our teams and organize action items.<br>\r\n</p>\r\n</div>\r\n</body>\r\n</html>\r\n"
},
"start":{
"dateTime":"2018-02-02T22:00:00.0000000",
"timeZone":"UTC"
},
"end":{
"dateTime":"2018-02-02T23:00:00.0000000",
"timeZone":"UTC"
},
"location":{
"displayName":"Mt. Hood"
},
"recurrence":null,
"attendees":[
{
"type":"required",
"status":{
"response":"none",
"time":"0001-01-01T00:00:00Z"
},
"emailAddress":{
"name":"Administrator",
"address":"admin#contoso.onmicrosoft.com"
}
},
{
"type":"required",
"status":{
"response":"tentativelyAccepted",
"time":"0001-01-01T00:00:00Z"
},
"emailAddress":{
"name":"Alex Wilber",
"address":"AlexW#contoso.onmicrosoft.com"
}
}
],
"organizer":{
"emailAddress":{
"name":"Administrator",
"address":"admin#contoso.onmicrosoft.com"
}
}
}
}
I would expect that the above filter would make the API return only the messages belonging to that event. However, it's giving me a 400 and I think it might be because of the syntax on how to filter in this specific case, but I can't find anything on their documentation about this. Does anybody know how to perform this kind of filter on the graph API?
I am trying to create a VSTS webhook subscription for publisherId= tfs and eventType= tfvc.checkin. Here's the sample Post request :
Url : https://testvstsaccount.visualstudio.com/_apis/hooks/subscriptions?api-version=1.0
Request Body :
{
"publisherId": "tfs",
"eventType": "tfvc.checkin",
"resourceVersion": "1.0-preview.1",
"consumerId": "webHooks",
"consumerActionId": "httpRequest",
"publisherInputs": {
"path": "$/"
},
"consumerInputs": {
"url": "https://myservice/myhookeventreceiver"
}
}
I am getting 400 Bad Request in response.
Response body :
{
"$id": "1",
"innerException": null,
"message": "Subscription input 'path' is not supported at scope 'collection'.",
"typeName": "Microsoft.VisualStudio.Services.ServiceHooks.WebApi.SubscriptionInputException, Microsoft.VisualStudio.Services.ServiceHooks.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"typeKey": "SubscriptionInputException",
"errorCode": 0,
"eventId": 4501
}
Can someone please help me understand the correct way to create this webhook.
The path is filtering to checkins that change one or more files under the specified path. It should look like $/TeamProject, or $/TeamProject/Project, or $/TeamProject/Project/.... $/ is not supported. Check my example below:
POST https://xxx.visualstudio.com/DefaultCollection/_apis/hooks/subscriptions?api-version=1.0
Content-Type: application/json
{
"consumerActionId": "httpRequest",
"consumerId": "webHooks",
"consumerInputs": { "url": "https://xxx.visualstudio.com" },
"eventType": "tfvc.checkin",
"publisherId": "tfs",
"publisherInputs": {
"path": "$/TestCase/TestCaseProject",
"projectId": "1decf66b-1974-43e3-xxxx-ba9a3fd2xxxx"
},
"resourceVersion": "1.0",
"scope": 1
}
I have tried to create sales receipt in quickbook using quickbook api. My most of sales receipt has successfully created at quick book without any issue. But quickbook api throw exception for one order. I have got below error:
{
"Fault": {
"Error": [
{
"Message": "Invalid Reference Id",
"Detail": "Invalid Reference Id : Line.SalesItemLineDetail.ItemRef",
"code": "2500",
"element": "Line.SalesItemLineDetail.ItemRef"
}
],
"type": "ValidationFault"
},
"time": "2017-05-04T03:32:18.942-07:00"
}
Below are json that I have tried with API :
{
"SalesReceiptEx":null,
"AutoDocNumber":null,
"CustomerRef":{
"name":"Alexander",
"type":null,
"value":"325"
},
"CustomerMemo":null,
"BillAddr":{
"Id":"1",
"Line1":"Alexander Kryukov",
"Line2":"22 Chester Terrace",
"Line3":"London",
"Line4":"United Kingdom,GB",
"Line5":"NW1 4ND",
"City":null,
"Country":null,
"CountryCode":null,
"CountrySubDivisionCode":null,
"PostalCode":null,
"PostalCodeSuffix":null,
"Lat":null,
"Long":null,
"Tag":null,
"Note":null
},
"ShipAddr":{
"Id":"2",
"Line1":"Alexander Kryukov",
"Line2":"22 Chester Terrace",
"Line3":null,
"Line4":null,
"Line5":null,
"City":"London",
"Country":"United Kingdom",
"CountryCode":null,
"CountrySubDivisionCode":"GB",
"PostalCode":"NW1 4ND",
"PostalCodeSuffix":null,
"Lat":null,
"Long":null,
"Tag":null,
"Note":null
},
"RemitToRef":null,
"ClassRef":null,
"SalesTermRef":null,
"DueDate":null,
"SalesRepRef":null,
"PONumber":null,
"FOB":null,
"ShipMethodRef":null,
"ShipDate":null,
"TrackingNum":null,
"GlobalTaxCalculation":null,
"TotalAmt":"136.90000",
"HomeTotalAmt":null,
"ApplyTaxAfterDiscount":null,
"TemplateRef":null,
"PrintStatus":null,
"EmailStatus":null,
"BillEmail":{
"Id":null,
"Address":"sash_300#hotmail.com",
"Default":null,
"Tag":null
},
"ARAccountRef":null,
"Balance":null,
"HomeBalance":null,
"FinanceCharge":null,
"PaymentMethodRef":null,
"PaymentRefNum":null,
"PaymentType":null,
"CheckPayment":null,
"CreditCardPayment":null,
"DepositToAccountRef":{
"name":"Business Bank Account HSBC",
"type":null,
"value":58
},
"DeliveryInfo":null,
"DiscountRate":null,
"DiscountAmt":null,
"GovtTxnRefIdentifier":null,
"DocNumber":1163080716,
"TxnDate":"2017-05-04",
"DepartmentRef":null,
"CurrencyRef":null,
"ExchangeRate":null,
"PrivateNote":null,
"TxnStatus":null,
"LinkedTxn":null,
"Line":[
{
"Id":1,
"LineNum":1,
"Description":"Flowery Floater Birthday Number",
"Amount":"43.29167",
"LinkedTxn":null,
"DetailType":"SalesItemLineDetail",
"PaymentLineDetail":null,
"DiscountLineDetail":null,
"TaxLineDetail":null,
"SalesItemLineDetail":{
"ServiceDate":null,
"TaxInclusiveAmt":null,
"DiscountRate":null,
"DiscountAmt":null,
"SalesItemLineDetailEx":null,
"ItemRef":{
"name":"Flowery Floater Birthday Number",
"type":null,
"value":"1"
},
"ClassRef":null,
"UnitPrice":"43.29167",
"RatePercent":null,
"PriceLevelRef":null,
"MarkupInfo":null,
"Qty":"1",
"UOMRef":null,
"ItemAccountRef":null,
"InventorySiteRef":null,
"TaxCodeRef":{
"name":null,
"type":null,
"value":2
}
},
"DescriptionLineDetail":null,
"ItemBasedExpenseLineDetail":null,
"AccountBasedExpenseLineDetail":null,
"DepositLineDetail":null,
"PurchaseOrderItemLineDetail":null,
"ItemReceiptLineDetail":null,
"JournalEntryLineDetail":null,
"GroupLineDetail":null,
"SubTotalLineDetail":null,
"TDSLineDetail":null,
"CustomField":null,
"LineEx":null
},
{
"Id":2,
"LineNum":2,
"Description":"Custom Product",
"Amount":"37.50000",
"LinkedTxn":null,
"DetailType":"SalesItemLineDetail",
"PaymentLineDetail":null,
"DiscountLineDetail":null,
"TaxLineDetail":null,
"SalesItemLineDetail":{
"ServiceDate":null,
"TaxInclusiveAmt":null,
"DiscountRate":null,
"DiscountAmt":null,
"SalesItemLineDetailEx":null,
"ItemRef":{
"name":"Custom Product",
"type":null,
"value":"10"
},
"ClassRef":null,
"UnitPrice":"3.75000",
"RatePercent":null,
"PriceLevelRef":null,
"MarkupInfo":null,
"Qty":"10",
"UOMRef":null,
"ItemAccountRef":null,
"InventorySiteRef":null,
"TaxCodeRef":{
"name":null,
"type":null,
"value":2
}
},
"DescriptionLineDetail":null,
"ItemBasedExpenseLineDetail":null,
"AccountBasedExpenseLineDetail":null,
"DepositLineDetail":null,
"PurchaseOrderItemLineDetail":null,
"ItemReceiptLineDetail":null,
"JournalEntryLineDetail":null,
"GroupLineDetail":null,
"SubTotalLineDetail":null,
"TDSLineDetail":null,
"CustomField":null,
"LineEx":null
},
{
"Id":3,
"LineNum":3,
"Description":"Additional Delivery Charge",
"Amount":"30.00000",
"LinkedTxn":null,
"DetailType":"SalesItemLineDetail",
"PaymentLineDetail":null,
"DiscountLineDetail":null,
"TaxLineDetail":null,
"SalesItemLineDetail":{
"ServiceDate":null,
"TaxInclusiveAmt":null,
"DiscountRate":null,
"DiscountAmt":null,
"SalesItemLineDetailEx":null,
"ItemRef":{
"name":"Additional Delivery Charge",
"type":null,
"value":"1"
},
"ClassRef":null,
"UnitPrice":"30.00000",
"RatePercent":null,
"PriceLevelRef":null,
"MarkupInfo":null,
"Qty":"1",
"UOMRef":null,
"ItemAccountRef":null,
"InventorySiteRef":null,
"TaxCodeRef":{
"name":null,
"type":null,
"value":2
}
},
"DescriptionLineDetail":null,
"ItemBasedExpenseLineDetail":null,
"AccountBasedExpenseLineDetail":null,
"DepositLineDetail":null,
"PurchaseOrderItemLineDetail":null,
"ItemReceiptLineDetail":null,
"JournalEntryLineDetail":null,
"GroupLineDetail":null,
"SubTotalLineDetail":null,
"TDSLineDetail":null,
"CustomField":null,
"LineEx":null
},
{
"Id":4,
"LineNum":4,
"Description":"Shipping Cost",
"Amount":"3.29167",
"LinkedTxn":null,
"DetailType":"SalesItemLineDetail",
"PaymentLineDetail":null,
"DiscountLineDetail":null,
"TaxLineDetail":null,
"SalesItemLineDetail":{
"ServiceDate":null,
"TaxInclusiveAmt":null,
"DiscountRate":null,
"DiscountAmt":null,
"SalesItemLineDetailEx":null,
"ItemRef":{
"name":"Shipping Cost",
"type":null,
"value":"1"
},
"ClassRef":null,
"UnitPrice":"3.29167",
"RatePercent":null,
"PriceLevelRef":null,
"MarkupInfo":null,
"Qty":"1",
"UOMRef":null,
"ItemAccountRef":null,
"InventorySiteRef":null,
"TaxCodeRef":{
"name":null,
"type":null,
"value":2
}
},
"DescriptionLineDetail":null,
"ItemBasedExpenseLineDetail":null,
"AccountBasedExpenseLineDetail":null,
"DepositLineDetail":null,
"PurchaseOrderItemLineDetail":null,
"ItemReceiptLineDetail":null,
"JournalEntryLineDetail":null,
"GroupLineDetail":null,
"SubTotalLineDetail":null,
"TDSLineDetail":null,
"CustomField":null,
"LineEx":null
}
],
"TxnTaxDetail":null,
"TxnSource":null,
"TaxFormType":null,
"TaxFormNum":null,
"TransactionLocationType":null,
"Id":null,
"SyncToken":null,
"MetaData":null,
"CustomField":null,
"AttachableRef":null,
"domain":null,
"status":null,
"sparse":null
}
Could anyone suggest, what is actual problem with this request?
The error message indicates exactly what the problem is:
"Message": "Invalid Reference Id",
"Detail": "Invalid Reference Id : Line.SalesItemLineDetail.ItemRef",
"code": "2500",
"element": "Line.SalesItemLineDetail.ItemRef"
Based on your request, it looks like you're just inventing these values, rather than actually querying these from QuickBooks.
I'm assuming this because in one place your item is called one thing, and in another it's called something totally different:
"ItemRef":{
"name":"Shipping Cost",
"type":null,
"value":"1"
},
Even though the Id values are identical (1) in both cases:
"ItemRef":{
"name":"Additional Delivery Charge",
"type":null,
"value":"1"
},
You can't just invent these numbers. They are Id values that you have to query from Intuit.
https://developer.intuit.com/docs/api/accounting/item
Query them by doing:
SELECT * FROM Item
I got this error when trying to submit an invoice line item with an ID outside the range of available IDs in the QuickBooks Sandbox.
For example, my production app has ~50 categories and the Sandbox only has ~20, so trying to use ID 40 in the Sandbox caused this error.
To resolve the issue I simply reduced the ID number for testing.