locked
Image Analysis API gives "statusCode": 500, "message": "Internal server error" RRS feed

  • Question

  • Hi,

    I have subscribed to the Microsoft Content Moderator API
    www.microsoft.com/en-us/Moderator/default
    developer.microsoftmoderator.com/

    I am trying to use the Image Analysis API for nudity detection, but it is giving me following error

    "statusCode": 500, "message": "Internal server error", "activityId": "1a796c1d-3918-4045-a92d-b3510848eff3"

    I am trying the CURL method. I tried to do via our app, and also tried by running the below command directly on the command prompt of our server.Could you please let me know what can we do to solve this issue?

            curl -v -X POST "https://api.microsoftmoderator.com/Image/v2/Evaluate" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: INSERTMYKEYHERE" --data-ascii "https://wbintcvsstorage.blob.core.windows.net/matchedimages/sample.jpg"


    Note: I enter my license key in place of "INSERTMYKEYHERE"


            * About to connect() to api.microsoftmoderator.com port 443 (#0)

            *   Trying 168.62.11.57... connected

            * Connected to api.microsoftmoderator.com (168.62.11.57) port 443 (#0)

            * Initializing NSS with certpath: sql:/etc/pki/nssdb

            *   CAfile: /etc/pki/tls/certs/ca-bundle.crt

              CApath: none

            * SSL connection using TLS_RSA_WITH_AES_256_CBC_SHA

            * Server certificate:

            *       subject: CN=*.microsoftmoderator.com

            *       start date: Sep 11 18:44:15 2014 GMT

            *       expire date: Sep 10 18:44:15 2016 GMT

            *       common name: *.microsoftmoderator.com

            *       issuer: CN=Microsoft IT SSL SHA2,OU=Microsoft IT,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US

            > POST /Image/v2/Evaluate HTTP/1.1

            > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2

            > Host: api.microsoftmoderator.com

            > Accept: */*

            > Content-Type: application/json

            > Ocp-Apim-Subscription-Key: INSERTMYKEYHERE

            > Content-Length: 70

            >

            < HTTP/1.1 500 Internal Server Error

            < Content-Length: 111

            < Content-Type: application/json

            < Date: Fri, 25 Mar 2016 13:17:37 GMT

            <

            * Connection #0 to host api.microsoftmoderator.com left intact

            * Closing connection #0

            { "statusCode": 500, "message": "Internal server error", "activityId": "85a9966b-8164-457d-ac2b-b65fc46f04b2" }



    Thursday, March 31, 2016 5:49 AM

Answers

  • One other thing - can you double-check if your payload type is correct?  The doc shows that the body should either be the image itself, or JSON of the following form:
    {
      "DataRepresentation":"URL",
      "Value":"https://moderatorsampleimages.blob.core.windows.net/samples/img_135.jpg"
    }

    It looks like you're just sending the URL as the body.

    Thursday, March 31, 2016 8:37 PM
    Moderator

All replies

  • Hi InternetMaster123, there was an outage, but this should be resolved by now.  Please post back if this is not the case.  Thanks, and sorry for the disruption.
    Thursday, March 31, 2016 8:30 PM
    Moderator
  • One other thing - can you double-check if your payload type is correct?  The doc shows that the body should either be the image itself, or JSON of the following form:
    {
      "DataRepresentation":"URL",
      "Value":"https://moderatorsampleimages.blob.core.windows.net/samples/img_135.jpg"
    }

    It looks like you're just sending the URL as the body.

    Thursday, March 31, 2016 8:37 PM
    Moderator
  • Yes, this was the case, I was sending wrong Body. I used the php implementation, and sent Body in following format, and it worked

    {
      "DataRepresentation":"URL",
      "Value":"https://moderatorsampleimages.blob.core.windows.net/samples/img_135.jpg"
    }

    Friday, April 1, 2016 7:35 AM
  • Hi,

    Now I am not getting any response from the server.. If I run this command

     curl -v -X POST "https://api.microsoftmoderator.com/Image/v2/Evaluate" -H "Content-Type: application/json; charset=utf-8" -H "Ocp-Apim-Subscription-Key: MYKEYHERE" --data-ascii "{'DataRepresentation' => 'URL', 'Value' => 'https://moderatorsampleimages.blob.core.windows.net/samples/img_135.jpg'}"

    * About to connect() to api.microsoftmoderator.com port 443 (#0)
    *   Trying 168.62.11.57... connected
    * Connected to api.microsoftmoderator.com (168.62.11.57) port 443 (#0)
    * Initializing NSS with certpath: sql:/etc/pki/nssdb
    *   CAfile: /etc/pki/tls/certs/ca-bundle.crt
      CApath: none
    * SSL connection using TLS_RSA_WITH_AES_256_CBC_SHA
    * Server certificate:
    *       subject: CN=*.microsoftmoderator.com
    *       start date: Sep 11 18:44:15 2014 GMT
    *       expire date: Sep 10 18:44:15 2016 GMT
    *       common name: *.microsoftmoderator.com
    *       issuer: CN=Microsoft IT SSL SHA2,OU=Microsoft IT,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US
    > POST /Image/v2/Evaluate HTTP/1.1
    > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
    > Host: api.microsoftmoderator.com
    > Accept: */*
    > Content-Type: application/json; charset=utf-8
    > Ocp-Apim-Subscription-Key: MYKEYHERE
    > Content-Length: 117
    >

    That's it. It doesn't give any response. What to do? How to know if there is an outage to the service? This could play havoc to my application...!!

    Saturday, April 2, 2016 1:12 PM
  • On this page, it is showing that all the services are running perfectly!

    https://azure.microsoft.com/en-in/status/


    Saturday, April 2, 2016 1:15 PM
  • What is the correct command, the below command via CURL still gives me 500 Internal Server error. But if I try the PHP implementation, then it works. What is the correct CURL command?

    curl -v -X POST "https://api.microsoftmoderator.com/Image/v2/Evaluate" -H "Content-Type: application/json; charset=utf-8" -H "Ocp-Apim-Subscription-Key: ENTERKEYHERE" --data-ascii "{'DataRepresentation' => 'URL', 'Value' => 'http://www.publicdomainpictures.net/pictures/80000/nahled/switserland-scenery-1394315639XLn.jpg'}"

    Above command still gives 500 Internal Server Error

    Monday, April 4, 2016 12:16 PM
  • Try this one:

    curl -v -X POST "https://api.microsoftmoderator.com/Image/v2/Evaluate" -H "Content-Type: application/json; charset=utf-8" -H "Ocp-Apim-Subscription-Key: ENTERKEYHERE" --data-ascii '{"DataRepresentation" : "URL", "Value" : "http://www.publicdomainpictures.net/pictures/80000/nahled/switserland-scenery-1394315639XLn.jpg"}'

    The JSON parser expects double quotes, and you should use ":" instead of "=>".

    Tuesday, April 5, 2016 1:00 AM
  • Try this one:

    curl -v -X POST "https://api.microsoftmoderator.com/Image/v2/Evaluate" -H "Content-Type: application/json; charset=utf-8" -H "Ocp-Apim-Subscription-Key: ENTERKEYHERE" --data-ascii '{"DataRepresentation" : "URL", "Value" : "http://www.publicdomainpictures.net/pictures/80000/nahled/switserland-scenery-1394315639XLn.jpg"}'

    The JSON parser expects double quotes, and you should use ":" instead of "=>".

    Many thanks! You saved my day.

    Tuesday, April 5, 2016 5:45 AM