9 Replies Latest reply on Sep 19, 2017 7:47 AM by davidm6

    Jive API : Unable to upload file to /static

    davidm6

      Hello all,

       

      I'm trying to upload a text file to the /static service, according to the documentation here : Jive REST API v3.14 → Static service

      The documentation says we must provide 2 sections :

      • a JSON representing the place where want to upload the file and the filename
      • a section containing the binary file

       

      I've tried many thing but it doesn't work

       

      When posting this to https://mycompany.fr/api/core/v3/statics

      --boundary
      Content-Type: application/json
      Content-Disposition: form-data; name="json"
      
      {"filename":"test.txt","placeURI":"https://mycompany.fr/api/core/v3/places/2514"}
      --boundary
      Content-Type: text/plain
      Content-Disposition: form-data; name=text; filename="test.txt"
      
      hello
      --boundary--

       

      I get this message :

      {

        "error" : {

          "message" : "invalidFileType",

          "context" : "invalidFileType",

          "status" : 400

        }

      }

      When I omit to put the section containing the file, I get this message :

      {

        "error" : {

          "message" : "There must be exactly one section containing the static resource data",

          "status" : 400

        }

      }

      It shows that the issue is relative to the file I want to upload, not the JSON section.

       

      Please note that I am able to post documents to the /attachment service using this kind of request :

      --boundary
      Content-Type: text/plain
      Content-Disposition: form-data; name=text; filename="test.txt"
      
      hello
      --boundary--

       

      So I think this is not an "upload" issue but a specific problem relative to the /static service.

      I also tried many mimetypes : text/plain, application/pdf, text/csv, etc.

       

      My questions :

      • Has anyone ever succeed to POST a file to the static service ?
      • Maybe I am missing something ?
      • What does the "invalidFileType" error refers to ?

       

      Many thanks !

       

      _David