[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ftpapi] REST Web service with HTTPAPI help request



I am using HTTPAPI version 1.39 and have been consuming SOAP services.

I now need to consume REST services and am going in circles.

I have successfully tested the methods in SoapUI and Postman.

Where I am struggling is how to create the additional headers required - well that is what I think is the problem.

From SoapUI this is the GET method;

(This is a user acceptance testing environment so I have not redacted the parameters)

GET https://uat.api.onegov.nsw.gov.au/oauth/client_credential/accesstoken?grant_type=client_credentials HTTP/1.1
Accept-Encoding: gzip,deflate
apikey: WmTFrOi8ZXBa0RBn6Tx2vYd3dnkOgtjj
authorization: Basic V21URnJPaThaWEJhMFJCbjZUeDJ2WWQzZG5rT2d0amo6cnRUcjk5amtockNhV0Z0aA
Host: uat.api.onegov.nsw.gov.au
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

I am using http_url_get_xml

I believe I want to put the two parameters (apikey and authorisation) into additional header details but I can't find an example of this.

From the debug log;

do_oper(GET): entered                                                                                                              
There are 0 cookies in the cache                                                                                                    
GET //oauth/client_credential/accesstoken?grant_type=client_credentials%20%20%20%20%20%20%20%20%20%20apikey:%20WmTFrOi8ZXBa0RBn6Tx2v
Host: uat.api.onegov.nsw.gov.au                                                                                                    
User-Agent: http-api/1.24                                                                                                          
                                                                                                                 
recvresp(): entered                                                                                              
HTTP/1.1 400 Bad Request                                                                                        
Date: Wed, 09 Jan 2019 04:04:48 GMT                                                                              
Content-Length: 227                                                                                              
Connection: keep-alive                                                                                          
Access-Control-Allow-Origin: *                                                                                  
Access-Control-Allow-Headers: origin, x-requested-with,accept,ContentType,client_secret,client_id,Authorisation  
Access-Control-Max-Age: 3628800                                                                                  
Access-Control-Allow-Methods: GET, PUT, POST, DELETE                                                            

SetError() #13: HTTP/1.1 400 Bad Request                                                                                            
recvresp(): end with 400                                                                                                            
recvdoc parms: identity 227                                                                                                        
header_load_cookies() entered                                                                                                      
recvdoc(): entered                                                                                                                  
SetError() #0:                                                                                                                      
{"ErrorCode" : "invalid_request", "Error" :"Unsupported grant type : client_credentials          apikey: WmTFrOi8ZXBa0RBn6Tx2vYd3dnk
SetError() #13: HTTP/1.1 400 Bad Request                                                                                            
http_close(): entered            

Any assistance or examples would be greatly appreciated.                                                                                                  

Don Brown

 
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi