Jump to content

Getting Contact details with Sales Invoice (API)


 Share

Recommended Posts

I am using the endpoint /sales_invoices/{key} to retrieve a sales invoice.  I also specify the following parameters:

"attributes" = "reference,vendor_reference,date,last_paid,net_amount,shipping_net_amount,tax_amount,total_paid,contact_id"
"nested_attributes" = "contact"

The API documentation suggests that I should be able to retrieve the nested data for contact, however the returned contact is null.
The API documentation showing the sample payload also suggests that the contact_id might be returned as a field in the main body, hence I have added this to my attribute list, however this is also returned as null.
The other data is returned as expected.

Any suggestions on how to retrieve the contact key for a sales invoice and sales credit note?

 

 

Link to comment
Share on other sites

Hi Stuart,

Are you able to provide the response body please(please mask any data that may be traceable to the business)?

The standard response for a GET request to sales_invoices/id should include the contact _id without requesting the nested_attributes. The below is taken from a response to sales_invoices/id.
 

"contact": {
"id": "e861ddf68bdd4bf3950c8084cd9ec13d",
"displayed_as": "Bronson Inc (BRO001)",
"$path": "/contacts/e861ddf68bdd4bf3950c8084cd9ec13d"
},
Link to comment
Share on other sites

This is all I get:

{{
  "id": "8057948faa504a7ea77f6399c7ae0408",
  "displayed_as": "SI-1008542",
  "$path": "/sales_invoices/8057948faa504a7ea77f6399c7ae0408",
  "date": "2022-11-30",
  "reference": "DN 19676",
  "shipping_net_amount": "51.0",
  "net_amount": "3242.72",
  "tax_amount": "12.83",
  "total_paid": "0.0",
  "last_paid": ""
}}

I am using the 32 character guid to retrieve the data.  I need to get data for pro-forma which don't have a numeric id assigned.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...