Page 1 of 1
					
				HTTP/1.1 415 Unsupported Media Type
				Posted: Thu Dec 08, 2022 1:41 am
				by Paul C
				what does this mean in my Diagnostic log? 
HTTP/1.1 415 Unsupported Media Type 
Thanks
Paul
			 
			
					
				Re: HTTP/1.1 415 Unsupported Media Type
				Posted: Tue Dec 20, 2022 6:20 pm
				by Scott Klement
				The HTTP server only accepts data in certain formats.  It's sending you "415 Unsupported Media Type" to tell you that it doesn't understand the format you've selected.
Typically if you send JSON, the media type should be "application/json".   If XML, sometimes they accept "text/xml" but the standard is really "application/xml".  But it all really depends on the specs for the API you're calling.
			 
			
					
				Re: HTTP/1.1 415 Unsupported Media Type
				Posted: Tue Dec 20, 2022 6:38 pm
				by Paul C
				Thanks for the info.  I think I see where the problem may be. so, I corrected where I have "application/json/" to "application/json" (without the "/" at the end. and now I am getting this error.  What does this mean?
SetError() #13: HTTP/1.1 400 Bad Request                               
recvresp(): end with 400                                               
recvdoc parms: identity 95                                             
header_load_cookies() entered                                          
recvdoc(): entered                                                     
SetError() #0:                                                         
recvdoc(): Receiving 95 bytes.                                         
{                                                                      
  "error": {                                                           
    "message": "Object reference not set to an instance of an object." 
  }                                                                    
}                                                                      
SetError() #13: HTTP/1.1 400 Bad Request                               
http_close(): entered
			 
			
					
				Re: HTTP/1.1 415 Unsupported Media Type
				Posted: Tue Dec 20, 2022 6:42 pm
				by Scott Klement
				Now it sounds like something is wrong with the JSON you are sending.   It says it has an object reference that isn't pointing to an object.
			 
			
					
				Re: HTTP/1.1 415 Unsupported Media Type
				Posted: Tue Dec 20, 2022 6:43 pm
				by Scott Klement
				Actually... thinking about it a little bit more... this sounds more like a Java error than a JSON one.  Perhaps the server is having some problems, too?
			 
			
					
				Re: HTTP/1.1 415 Unsupported Media Type
				Posted: Tue Dec 20, 2022 6:54 pm
				by Paul C
				do you mean our AS400 might not have the latest JAVA version?  thanks
			 
			
					
				Re: HTTP/1.1 415 Unsupported Media Type
				Posted: Tue Dec 20, 2022 7:04 pm
				by Scott Klement
				Aren't you writing your program in RPG?  Why would it matter what version of Java you have?!?!
			 
			
					
				Re: HTTP/1.1 415 Unsupported Media Type
				Posted: Tue Dec 20, 2022 8:15 pm
				by Paul C
				yes, it is written in RPG.  It is the question you mentioned with JAVA error and server error? would this be an error on our AS400 or the other server that we are trying to connect to?
			 
			
					
				Re: HTTP/1.1 415 Unsupported Media Type
				Posted: Tue Dec 20, 2022 10:58 pm
				by Scott Klement
				RPG programs cannot produce Java errors.
My guess is that the HTTP server you are connecting to is using Java, and it has a bad reference to a Java object in it's code.