Trying to add item to Portfolio via API, but get 400



Error: Request failed with status code 400

API says the insert_after and insert_before are Required, but what if portfolio is empty?

Please, someone help… What am i doing wrong?

@Joe_Trollo @Ross_Grambo Can you help? I haven’t worked with the portfolios API yet.

1 Like

Hi @dgraid,

OK, I decided it was time for me to explore portfolios, so I took a look at this.

First, adding an item to a portfolio is a POST, so I don’t think you’re going to be able to send the parameters via the query string. I was not able to make that work. When I sent them in the request body, it successfully added my item. Here it is in Postman:


Second, you do not need to include insert_before or insert_after. If you exclude them both, it adds the item as the last item in the list (or as the only item in the list if there are no others!).

Oh! That was easy, I even could try it my self.

I was messed up with this one:

I will try doing POST with payload - sure, that it will work.

Thank you so much!!

1 Like

Yeah, I filed a report for that documentation error (Documentation error for "Add a portfolio item").

1 Like

Thanks for finding this! Those should definitely not be query params. Thanks @Phil_Seeman & @dgraid!

1 Like