Invoice RenderAsPdf for Essentials returns JSON not PDF

This thread is now closed to new comments.
Some of the links and information provided in this thread may no longer be available or relevant.
If you have a question please start a new post.
2 REPLIES 2
ECCC
2 Posts
User
User

2Posts

0Kudos

1Solutions

Accepted Solution Solved

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,369 Posts
Ultimate Partner
New Zealand
Ultimate Partner

4,369Posts

1,920Kudos

549Solutions

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)

ECCC
2 Posts
User
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