| Author | 
		  Message
		 | 
		
		  | madrox | 
		  
		    
			  
				 Posted: Wed Oct 18, 2017 12:48 pm    Post subject: Attaching an Image | 
				     | 
			   
			 
		   | 
		
		
		    Acolyte
 
 Joined: 11 Mar 2015 Posts: 71
  
  | 
		  
		    
			  
				I am creating an application as a test to make a call to a free API available called OCR. OCR requires me to send a image file or a pdf and it converts it to txt, pdf or other text format. 
 
So I have a HTTP Input node that I use to trigger the flow and a File Read node to get the file that I need to send in my request payload.
 
From reading a few threads on the forum I have made an assumption(maybe wrong on) that I should use MIME to parse the input message. When I do use a MIME parser the message tree does not populate anything for MIME. When I have used xml earlier I see the data in the message tree under XMLNSC, but I am unsure what should be done for PDF's and JPEG's.
 
I am sure I am doing something wrong could someone please suggest what I should be doing?
 
Thanks | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | madrox | 
		  
		    
			  
				 Posted: Tue Oct 24, 2017 12:41 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Acolyte
 
 Joined: 11 Mar 2015 Posts: 71
  
  | 
		  
		    
			  
				update:
 
I could not figure out how to send a file as an attachment in my request, the API documentation has an option in the Post Paramenter to send the file as base64image. So i read the file from my file input with blob as a input message parser, converted it to base 64 and built my request. But now i get a error after the HTTP request, "414 Request-URI Too Long". See my code below from the compute after the file read. 
 
 
   
	| Code: | 
   
  
	      DECLARE var1 CHARACTER BASE64ENCODE(InputRoot.BLOB.BLOB);
 
      SET OutputLocalEnvironment.Destination.HTTP.RequestURL = 'http://api.ocr.space/parse/image';
 
      SET OutputLocalEnvironment.Destination.HTTP.QueryString.apikey = 'apidummykey';
 
      SET OutputLocalEnvironment.Destination.HTTP.QueryString.language ='ENG';
 
      SET OutputLocalEnvironment.Destination.HTTP.QueryString.isOverlayRequired ='TRUE';
 
      SET OutputLocalEnvironment.Destination.HTTP.QueryString.base64Image=var1; | 
   
 
 
 
In my debug mode i see the local environment overrides but my response header has 414. 
 
 
   
	| Code: | 
   
  
	HTTPResponseHeader
 
   X-Original-HTTP-Status-Line:CHARACTER:HTTP/1.1 414 Request-URI Too Long
 
   X-Original-HTTP-Status-Code:INTEGER:414
 
   Content-Type:CHARACTER:text/html; charset=us-ascii
 
   Server:CHARACTER:Microsoft-HTTPAPI/2.0
 
   Date:CHARACTER:Tue, 24 Oct 2017 20:36:10 GMT
 
   Connection:CHARACTER:close
 
   Content-Length:CHARACTER:329 | 
   
 
 
	
 
I am sure that there is something that i am missing or getting wrong. Any help will be appriciated! | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | timber | 
		  
		    
			  
				 Posted: Tue Oct 24, 2017 3:16 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand Master
 
 Joined: 25 Aug 2015 Posts: 1292
  
  | 
		  
		    
			  
				| Are you sending an image in the query string? Not in the message body? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | madrox | 
		  
		    
			  
				 Posted: Tue Oct 24, 2017 4:46 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Acolyte
 
 Joined: 11 Mar 2015 Posts: 71
  
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Wed Oct 25, 2017 5:04 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
 
 
I find it as odd as my worthy associate that anyone would want a JPG in a query string.
 
 
Also interesting is that that URL is on my company's blacklist as an untrustworthy site. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | madrox | 
		  
		    
			  
				 Posted: Wed Oct 25, 2017 5:20 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Acolyte
 
 Joined: 11 Mar 2015 Posts: 71
  
  | 
		  
		    
			  
				Hmm that's odd, I thought that it is a legit site, but this is just for a POC that I am building for myself.
 
Just to reconfirm post parameters are sent as a query string correct? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |