User Profile
Joonas_Virtasoft
5
Posts
0
Kudos
0
Solutions
31-05-2023
15:38
I also encountered this problem when we were supposed to update my clients integration to use the new SalesOrder API and also change the authentication method for the Service endpoints at the same time. Everything else seemed to work (SalesOrders, Inventory items and quantities, Customers..) but when trying to add a payment to a SalesOrder using CustomerPayment we received the error: "Error creating payment. Error: BranchID' not found in the system. Check whether you have access rights to this object." We have decided to rollback to the older version for now. I hope the culprit is found for this issue (be it requirements for user settings or something that needs to be fixed in the API itself), I'm also happy to provide additional information if needed.
... View more
08-12-2020
11:08
Yes I understand, thank you and everyone else for the examples given so far. I will try to debug this and see what is the culprit in my code that does something different.
... View more
07-12-2020
14:31
I finally had time to continue with this. I read through all the answers and tried to pinpoint my issue. I changed my endpoint to controller/api/v1/customerinvoice/<invoiceid>/attachment so my testing would be on par with the instructions here, even though my end goal is to add an attachment to a product. But, I'm still facing the same issue. My problem was not with non-ASCII characters in filename, as I don't have them in the filename, but if I understood correctly from Yildirims post the filename parameter should NOT be in the Content-Disposition header at all, but as a dedicated header. So I tried this: Headers: Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
ipp-application-type: Visma.net Financials
Authorization: Bearer <token>
ipp-company-id: <companyId>
Host: integration.visma.net
Content-Length: 288538 (this is the filesize of Lippis.png) Body: -------------------------acebdf13572468
Content-Disposition: form-data; name="file";
filename="Lippis.png"
Content-Type: image/png
file data here
-------------------------acebdf13572468 But I still keep getting: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html> If I leave this out: Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468 so it defaults to: application/json I get: {"ExceptionType":"IPPException","ExceptionMessage":"","ExceptionFaultCode":"5520","ExceptionMessageID":"5520_6685f9d9-d7e6-4e7d-98e7-800638d96d3a","ExceptionDetails":""} I know there is something wrong with my request, because the examples above a proved to be working by you, but I just can't wrap my head around it... I've tried numerous ways and played around with the Content-Disposition header and Content-Types, to see if they make a difference but nothing... I'm starting to think there might be something wrong with the way Qt creates the Multipart data (how it inserts the file data to the request), because that's pretty much the only thing I don't control in the request, at the moment.
... View more
04-12-2020
11:31
Thank you, I will try again with these instructions! I'll get back to this.
... View more
03-12-2020
16:25
Hello, I have a problem uploading a product image, as an attachment, for a product via the Visma.NET API. I'm using C++ with Qt, and trying to replicate the request example (written in C#) from here: https://community.visma.com/t5/Knowledge-base-in-Developers/How-to-POST-an-attachment-via-Visma-net-API-in-C/ta-p/273574 I've came with a solution like this: ...
httpRequest req;
this->initRequest(&req, "controller/api/v1/inventory/"+itemID+"/attachment");
QHttpMultiPart *multipart = req.initMultipart(QHttpMultiPart::FormDataType);
QHttpPart imagePart;
imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/octet-stream"));
imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"file\"; filename=\"" + fileName + "\""));
imagePart.setBody(fileData);
multipart->append(imagePart);
req.waitForData(httpRequest::POST);
... Few notes: - fileData variable in this scope is a QByteArray, containing the data of the image file. - httpRequest class is one made by me, to handle different kind of HTTP Requests. - initRequest initializes the request by adding necessary authentication headers etc. to the request. This part is confirmed working on other endpoints which work fine. The API returns with a 400 - Bad request, with response: {"ExceptionType":"IPPException","ExceptionMessage":"","ExceptionFaultCode":"5520","ExceptionMessageID":"5520_09efa0b5-ac3b-48f8-a8c7-f9095f86a746","ExceptionDetails":""} I feel like I've tried everything... Does anyone have a working, raw request they could show so I could try and mimic that?
... View more
Activity Feed for Joonas_Virtasoft
- Posted Vastaus: No access to branch when trying to create SupplierInvoice on Forum in Developers Visma.net. 31-05-2023 15:38
- Posted Vastaus: Problem uploading an attachment to produt (product image) on Forum in Developers Visma.net. 08-12-2020 11:08
- Posted Vastaus: Problem uploading an attachment to produt (product image) on Forum in Developers Visma.net. 07-12-2020 14:31
- Posted Vastaus: Problem uploading an attachment to produt (product image) on Forum in Developers Visma.net. 04-12-2020 11:31
- Posted Problem uploading an attachment to produt (product image) on Forum in Developers Visma.net. 03-12-2020 16:25
- Kudoed Re: Unexpected behaviour in lineNbr for the SalesOrder entity when deleting/adding order lines? for Anonymous. 14-10-2020 14:34
- Kudoed Re: Unexpected behaviour in lineNbr for the SalesOrder entity when deleting/adding order lines? for Yıldırım. 14-10-2020 14:34