Jump to content

"$message": "purchase_invoice[invoice_lines] is invalid"


Why did I get this error ? "$message": "purchase_invoice[invoice_lines] is invalid"  

  1. 1. Why did I get this error ? "$message": "purchase_invoice[invoice_lines] is invalid"

    • ??
      0
    • ??
      0


Recommended Posts

postman_error.png

I'm  trying to learn the sage api
I've tried to make a POST request for create a purchase invoice
so I did as the documentation but i get this error message.
 "$message""purchase_invoice[invoice_lines] is invalid"
and I don't know why.

Can someone help me ? 


 

Link to post
Share on other sites
  • Administrators

Hi Aladin,

This is most likely because you are passing the attributes and values as query params. You need to ensure you build a JSON body as per our API reference, passing the values accordingly, along with a header of Accept: application/json:

Purchase Transactions | Sage Developer

{
  "purchase_invoice": {
  "contact_id": "string",
  "date": "2019-08-24",
  "due_date": "2019-08-24",
  "reference": "string",
  "total_quantity": 0,
  "net_amount": 0,
  "tax_amount": 0,
  "total_amount": 0,
    "invoice_lines": [
    ...
    ],
  	"tax_analysis": []
  }
}

Once you've had a look at the guide I've linked above it should make sense. Let me know if you still have any issues.

 

Ben

  • Like 1
Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...