cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to access URL(API ) from program

former_member610437
Discoverer
0 Kudos

Hi,

I am using a mapquest API to get navigation details 2 places. I am calling the API as shown below.

Following is the URL and code I have written for the same.

http://www.mapquestapi.com/directions/v2/route?key=76BpT0PsHAJWGXQAzkV3StwF2AlVDecN&from=Av.+Monteve...

lv_service ='http://www.mapquestapi.com/directions/v2/route?key=76BpT0PsHAJWGXQAzkV3StwF2AlVDecN&from=Av.+Monteverde+2211,+B1852+Burzaco,+Buenos+Aires,+Argentina&to=B1852,+Luis+Mar%C3%ADa+Drago+1760,+B1852LGX+Burzaco,+Buenos+Aires,+Argentina'.

cl_http_client=>create_by_url(
EXPORTING
url = lv_service
IMPORTING
client = lo_http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4 ).

lo_http_client->request->set_method( 'GET' ).

lo_http_client->send(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2 ).

lo_http_client->receive(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3 ).

lv_response = lo_http_client->response->get_cdata( ).

I am getting the error in lv_response.

Is this a basis issue or is it the program...

Please advice

Vijay.

Accepted Solutions (0)

Answers (3)

Answers (3)

arthursilva
Active Participant
0 Kudos

Hello,

I notice that you've facing error NIECONN_REFUSED, so SAP note https://apps.support.sap.com/sap/support/knowledge/preview/en/1916333 clarifies detailled how to solve this issue.

KR,
Arthur Silva

former_member610437
Discoverer
0 Kudos

Hi Pavan,

I am using the URL provided for GET method in MAPQUEST link below.

https://developer.mapquest.com/documentation/directions-api/route/get/

If you check the code in the above thread, I am passing the KEY that I generated. And when I am calling the same URL in the browser, I am getting the JSON response with the required information.

I couldn't find where to pass the consumer key/ consumer secret key. Could you please clarify on this.

Thanks,

Vivek.

bpawanchand
Active Contributor
0 Kudos

Hi,

If you access the API then you should need to provide the API token or API key as well as Consumer key and consumer secret key.

However, I would suggest to make use of postman inspector chrome extension which can help you to add all these paramteres and check.

I guess also make sure you have a call back URI which actaully holds the result of the API call.

Read the documentation of MAPQUEST

the example call is clearly defined as below in which you need to pass the comsumer key.

http://www.mapquestapi.com/datamanager/v2/get-tables?key=KEY∈Format=json&outFormat=json

Thanks

Pavan