Expand my Community achievements bar.

Using Classifications API to upload file automatically

Avatar

Level 4

Premise: I am creating a process where a maintained classifications file can be fully or partially manually be uploaded to Analytics' Classifications API and data is updated. This can be done with relative ease using FTP file transfer to send items in, but since the API has more options, we decided to investigate would it cover our needs. Even though the Classifications Datasets are a bit more hassle to explain and especially to get them programmatically with indications which one to use, I've managed to build the flow nicely and can run everything in Postman Flows. Almost everything that is.

There was another post (I will add a link when I find it) that was trying to do something similar and ran into this issue as well. Sending the upload lead to this error message:

{
    "errorCode": "500",
    "errorDescription": "Cannot invoke \"javax.servlet.http.Part.getInputStream()\" because \"filePart\" is null",
    "errorId": "abcd1234"
}

What this means is that the receiving Java servlet cannot find the file uploaded to process. This is likely because the documentation does not say where that file is supposed to be attached, as we can see here: Import API classifications by uploading files, more specifically this part:

SSampsa_0-1732785726402.png

This defines the name of the file and where that file is located on the sending device. All good, but that doesn't actually mean the file is attached to the request in cURL, nor will cURL try to read it based on these values. I have tried to replace the "Value" with cURL's upload syntax, added a new field and so on, but since I don't know the name of the field, the file never gets processed. In another post I read comments related to the file not being accessible, which should not be the case, but to be sure I ran the same code in cURL locally in Windows directly, as well as a separate Unix server, all with the same results.

 

To put this shortly: Does anyone know what is the filename Classifications API file upload is expecting, so I could successfully send a file to it, OR alternatively: Am I doing this wrong and the API example should work as defined?

 

1 Reply

Avatar

Level 4

In relation to the question I referred, one of the replies referred to file uploads to cloud destinations (Locations) and file locations. This, I think, is the issue: I consider file uploads to be actual uploads, but in reality they are likely ways to tell Classifications API in which cloud location the file is and to download it from there, rather than actually being a file upload. In my opinion this naming is a bit misleading and the documentation does not refer to locations in any way. I will test this out and see if this solves my issue.