MYOBCommunity
Partner Zone
|
|
Partner Zone

Invoice RenderAsPdf for Essentials returns JSON not PDF

2 REPLIES 2
ECCC
2 Posts
User
ECCC
User

2Posts

0Kudos

1Solutions

Accepted Solution Solved Solution

Re: Invoice RenderAsPdf for Essentials returns JSON not PDF

Ok, I figured it out. I forgot to set the headers with curl. What a dunce!

 

It's working like a charm now.

Ultimate Partner Mike_James
4,189 Posts
Ultimate Partner
New Zealand
Mike_James
Ultimate Partner

4189Posts

1835Kudos

523Solutions

Re: Invoice RenderAsPdf for Essentials returns JSON not PDF

Hi @ECCC , could it make a difference if you use "Accept: application/pdf" (note lower-case), following the style of the json header?


Regards, Mike (mike@datawise.co.nz)
DataWise Limited (www.datawise.co.nz), developers of:
DataWise Report Writer - Custom Reporting from MYOB programs
(Including AccountRight Classic/Live, and exo Payroll)
New: S.T.P. Reporting solution for (Aust) v19 users, email for details

Highlighted
ECCC
2 Posts
User
ECCC
User

2Posts

0Kudos

1Solutions

Solved: Go to Solution

Invoice RenderAsPdf for Essentials returns JSON not PDF

I am trying to use the RenderAsPdf api functionality to return a pdf of my requested invoice.

 

I am doing a get request to https://api.myob.com/au/essentials/businesses/683041/sale/invoices/374108193

 

The api instructions for RenderAsPdf say that all I need to do is pass an additional HEADER Accept: Application/PDF which I do as you can see from my list of headers below:

 

[
  0 => "Authorization: Bearer [my access token]"
  1 => "x-myobapi-key: [my key]"
  2 => "x-myobapi-version: v0"
  3 => "Accept: application/json"
  4 => "x-myobapi-cftoken: Og=="
  5 => "Accept: Application/PDF"
  6 => "Accept-Encoding: gzip,deflate"
]

 

When I do this request I get the invoice as JSON, not as a PDF. Any ideas what could be going wrong?

Didn't find your answer here?
Try using advanced search to find a post more easily Advanced Search
or
Get the conversation started and make a new post Start a Post