Developing an application that uses the Caspio API and facing weird issues with caspio api.For 3 days, I'm not able to understand the issue.
I have posted many articles on different forums, but no good answers. Right now, I am getting 400 Status code message on implementing the solution. What is going wrong in the solution?
I am doing authentication using CASPIO below:
As an alternative to including credentials in the request body. I am including credentials in the body. Right now, a client can easily use HTTP basic authentication. In my method, I am following the following way of authenticating:
Method in PHP: Post
URL I am trying to use: Endpoint
Body of the code: access_type = login and password of client
Codes:
Javascript
varCurrentfuncuser="clientID";var funcuserPass ="secretKey";function authenticatetheUser(funcuser, funcuserPass){var authtok = funcuser +":"+ funcuserPass;// Should i be encoding this value????? does it matter???// Base64 Encoding -> btoavar currentH = btoa(authtok);return"Simple"+ currentH;}functionCallingtheAPI(){// New XMLHTTPRequestvar newXMLRequest =newXMLHttpRequest();
newXMLRequest.open("POST","https://xxx123.caspio.com/oauth/token",false);
newXMLRequest.setRequestHeader("Authorization", authenticatefuncuser(Currentfuncuser, funcuserPass));
newXMLRequest.send();// view request status
alert(newXMLRequest.status);
response.innerHTML = newXMLRequest.responseText;}
HTML
<div><divid="response"></div><inputtype="button"class="primary"value="Simple API Call"onclick="javascript:CallingtheAPI;"/>
Solutions tried:
Someone told that you need oAuth authentication protocol rather than simple authentication. After that have to set 'setHeaderRequest', with changes.
Another Issue:
I am handling some clients websites. And when, I tried to work with maps API, which are currently telling the locations of the bases. And also, multiple zoom-in maps on the directory pages, but the pages are loading slowly. Example, militarybases.....navy-base-kitsap-navy-base-in-silverdale-wa/ contain only 1 map. And I want to host multiple maps(which is necessary in order to show the clearly zoomed-in location). It is the test phase, if successful. I have to integrate the full site.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
JoellaLoge
Developing an application that uses the Caspio API and facing weird issues with caspio api.For 3 days, I'm not able to understand the issue.
I have posted many articles on different forums, but no good answers. Right now, I am getting 400 Status code message on implementing the solution. What is going wrong in the solution?
I am doing authentication using CASPIO below:
As an alternative to including credentials in the request body. I am including credentials in the body. Right now, a client can easily use HTTP basic authentication. In my method, I am following the following way of authenticating:
Method in PHP: Post
URL I am trying to use: Endpoint
Body of the code: access_type = login and password of client
Codes:
Javascript
HTML
Solutions tried:
Someone told that you need oAuth authentication protocol rather than simple authentication. After that have to set 'setHeaderRequest', with changes.
Another Issue:
I am handling some clients websites. And when, I tried to work with maps API, which are currently telling the locations of the bases. And also, multiple zoom-in maps on the directory pages, but the pages are loading slowly. Example, militarybases.....navy-base-kitsap-navy-base-in-silverdale-wa/ contain only 1 map. And I want to host multiple maps(which is necessary in order to show the clearly zoomed-in location). It is the test phase, if successful. I have to integrate the full site.
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.