6 Replies Latest reply on Mar 11, 2016 5:29 AM by umesh

    Upload New Image with core api v3

    umesh

      All,

       

      I am using core api v3. I am trying to create user profile and to do this I need to upload new image and then pass url as  profile image. I am facing error The remote server returned an error: (404) Not Found.

       

      I tried to pass request with below URL

       

      1)  https://zsassociates.jiveon.com/core/api/v3/people/imageservice/images?cachebuster=3/8/2016 1:11:43 PM - uc6902

      2) https://zsassociates.jiveon.com/core/api/v3/people/imageservice?cachebuster=3/8/2016 1:13:03 PM - uc6902

      3) https://zsassociates.jiveon.com/core/api/v3/people/?cachebuster=3/8/2016 1:15:20 PM - uc6902

       

      but same error all the time.

       

      Can you please help me?

       

      Thanks

        • Re: Upload New Image with core api v3
          Ryan Rutan

          First thing to change is your URL, it should read:

          /api/core/v3/people/....

           

          Switch that and you should be in a much better place. =)

            • Re: Upload New Image with core api v3
              umesh

              Thanks Ryan. It work for me to resolve that issue.

               

              But again I am facing new issue.

               

              The remote server returned an error: (415) Unsupported Media Type. - https://zsassociates.jiveon.com/api/core/v3/images - uc6902

               

              Here is my C# Code:

               

               

              requestPayload = new XElement("uploadImage", new XElement("content-type", "application/json"), new XElement("mediaType", "application/json"), new XElement("imageURI", StrPicUrl));

               

              XElement responseText = ApiRequest.GetResponse(requestUrl, requestPayload.ToString(), "POST", _apiCredentials, networkId);               

               

               

               

                • Re: Upload New Image with core api v3
                  Ryan Rutan

                  Do you debug information of the actual Json and headers that cross the wire?  Also, you can drop the media type header.

                   

                  Normally this error suggests that either the Json you are sending is invalid, or you are not declaring the content-type header correctly.

                    • Re: Upload New Image with core api v3
                      umesh

                      This is format of data, I am sending

                       

                      <uploadImage>

                        <content-type>application/json</content-type>

                        <image>\\zs-adfs01.zs.local\photozs_prod\ZSpaceProfile\uc6902.jpg</image>

                      </uploadImage>

                        • Re: Upload New Image with core api v3
                          Ryan Rutan

                          UMesh, you are passing XML (not JSON), and also you are passing HTTP Headers as part of the body, rather than in headers. 

                           

                          Here is an example of calling an images service:

                          curl -i -u user:pass -X POST -F "file=@your_file.jpg;type=image/jpg" "https://your_jive_instance/api/core/v3/images"

                           

                          Note: That this is a Multi-Part request.  Once this request completes and you get a 201, there will be a Location header in the response that has the Jive API URI for the new image you uploaded that you can use to pass into other parts of the API.

                           

                          I would strongly recommend that you try the cURL operation first, and then structure your .NET code to emulate the outputs.  As it stands, it does not appear that you are following the REST service defined here: Jive REST API v3.14 → Image service

                           

                          Hope that helps.

                            • Re: Upload New Image with core api v3
                              umesh

                              Thanks Ryan.

                               

                              I tried with CURL but facing below issue.

                               

                              Error:

                              curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:

                              error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

                               

                              SSL is disable at our site and we have tlsv version1. Can you please let me know the command for the same.?

                              Thanks