Community
Showing results for 
Search instead for 
Do you mean 
Reply

Adding an Attachment using the Web API

Highlighted
Silver Super Contributor
Posts: 2,341
Country: USA

Re: Adding an Attachment using the Web API

I'm using Postman to test it but I can't even get it to work in Postman.  I get either the error message that it is an unsupported media type or I get an internal server error.  Clearly I'm missing something.


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
Highlighted
Employee
Posts: 123
Country: USA

Re: Adding an Attachment using the Web API

Are you getting a this error:
 
Status: 500 Internal Server Error
The INSERT statement conflicted with the FOREIGN KEY constraint \"ATTACHMENT_HISTORYID_FK\". The conflict occurred in database \"BurtonBox\", table \"dbo.TBL_HISTORY\", column 'HISTORYID'.\r\nThe statement has been terminated.
 
if so, it might be that the Guid in the URL doesn't exists as a document. After you post a document (api/documents) make sure you get the id (guid) and pass that to the second call to api/attachments/documents/{id}.
If that is not your error please send me both API calls.
 
image.png
Highlighted
Silver Super Contributor
Posts: 2,341
Country: USA

Re: Adding an Attachment using the Web API

No.  I'm getting sequence contains no elements.


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
Highlighted
Silver Super Contributor
Posts: 2,341
Country: USA

Re: Adding an Attachment using the Web API

How did you come up with the key "Postman_Dump.json"?


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
Highlighted
Silver Super Contributor
Posts: 2,341
Country: USA

Re: Adding an Attachment using the Web API

Can you send me detailed screen shots of all of the posts you are making in Postman or can you send me a Postman template for it?


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
Highlighted
Silver Super Contributor
Posts: 2,341
Country: USA

Re: Adding an Attachment using the Web API

Nevermind.  I figured it out finally.  It wasn't obvious to me at least what the problem was.  I needed to create a key for the file in the form-data section and select a file in there to upload instead of selecting a file in the binary section.  Hopefully that will save someone else a little time when trying to upload a file using Postman.


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!