Each time I try to authenticate with api.ai I receive a 401 Unauthorized error.
I am using postman and I have tried both my Client access token and Developer access token. Neither seem to work.
This is the body that I am attempting to send:
{
"query": [
"hi"
],
"timezone": "America/New_York",
"lang": "en",
"sessionId": "1a63011b-0eb7-4f0e-b75a-7dc0fa67a8b0"
}
Screen shot of the postman POST attempt
What could be causing the authentication error?
Check your url(https://api.api.ai/api/query?v=20150910). It should be: https://api.api.ai/v1/query?v=20150910
There are two query types GET and POST.
https://api.ai/docs/reference/agent/query#get_query
While using postman. I tried POST it worked.
Choose option POST and put this URL (https://api.api.ai/v1/query?v=20150910)
under the Header option.
Create Authorization Key like
key-> Authorization and the value -> Bearer xxxx
where x is your client access token.
Set content type application/json
key - > Content-Type and the value -> application/json
Header part is over.
Body. (raw JSON)
{ "query": "hi",
"lang": "en",
"sessionId": "1234567890"}
then send it will work.
Note: Body object should have at-least these fields to work.
Related
I'm not sure if this is a bug. But I discovered this in sandbox while creating an embedded signing link.
When attempting to call the below post with the following body, I get a 400 Bad Request Data Object errorCode: "INVALID_REQUEST_PARAMETER" message: "The request contained at least one invalid parameter. A value was not found for parameter 'userName'."
POST /v2/accounts/{accountId}/envelopes/{envelopeId}/views/recipient
Accept: application/json
Origin: https://apiexplorer.docusign.com
Content-Type: application/json
Show Base64 Bytes in Request
{
"authenticationMethod": "none",
"email": "myemail#example.com",
"returnUrl": "google.com"
}
So it makes sense to add a userName to my recipient right? Well, yes but no. I can type in any random userName like
{
"authenticationMethod": "none",
"email": "myemail#example.com",
"returnUrl": "google.com",
"userName": "sdlfkjsodisdofisdofm"
}
And it will generate the link a successful response with an embedded link. It appears to look for email first as precedence which is what I want. What's the purpose of userName here?
So, I think if the user is not authenticated ("none") then userName is ignored, but still is required. Which does seem like a bug, so good catch. If you want to do more testing - try v2.1, which is the latest API version we recommend you use and see if it behaves the same (most likley, but not 100% sure).
The reason userName may be needed is for example for InPersonSigner or when you use recipientAuthentication and the user needs to be correlated to a DocuSign user in some account to be able to use their auth correctly.
Edit: Actually, userName would be used to determine your set of signatures. Try this, set your signature and use the exact same userName. DocuSign should remember it and you won't have to do that again. If you use a different one - you would have to. So, maybe not a bug after all...
(same for the electronic consent that you only have to agree to once)
I have a node lambda function that I want to decode and read the payload of a jwt. I created a get method with lambda proxy integration enabled, and i'm only passing the authorization bearer-token to the endpoint. When i do this, event is completely empty. How can i pass the jwt to the lambda function?
If you return the event and it's empty then it sounds like some type of configuration is not set up correctly rather than the authorization header not being passed.
According to the docs the proxy integration requires the lambda output in the following format:
{
"isBase64Encoded" : "boolean",
"statusCode": "number",
"headers": { ... },
"body": "JSON string"
}
Make sure your Lambda returns a similar output.
First of all - all code on PHP and JS.
I took all user data (sub, base_uri, account_id ) with that documentation https://developers.docusign.com/esign-rest-api/code-examples/config-and-auth at my site using cURL
Now I need send pdf file for that I generate at my site with that access for user sign like I have understood I need that https://developers.docusign.com/esign-rest-api/code-examples/signing-from-your-app and Envelopes: create https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create#examples
I send POST request to https://demo.docusign.net/restapi/v2/accounts/{accountId}/envelopes with accountId=account_id from user data, also I send json with user data and doc data in base64 in, but there is nothing, so I don't understand:
How should I call "create" method with POST to https://demo.docusign.net/restapi/v2/accounts/{accountId}/envelopes ?
What Id should I use in {accountId}?
At what format should I send the document for the sign?
Where can I find that doc after create?
Can you show me code example or show documentation with normal examples of POST request for that method.
If you are using a demo environment, I believe your authentication url is https://demo.docusign.net/restapi/v2/login_information. For production accounts, since the subdomain can be different you can find the correct baseUrl using a GET request to https://www.docusign.net/restapi/v2/login_information?api_password=true using Postman. This gives you the right baseUrl as well as your authentication information.
Here is how you can create a template using a base64 which is a POST call to {{baseUrl}}/templates
{
"documents": [
{
"documentBase64": "<insert encoded base64 here",
"documentId": "1",
"name": "blank1.pdf"
}
],
"envelopeTemplateDefinition": {}
}
Also, if you need to generate more requests make sure you check out the Postman collection that contains different examples as Sebastian mentioned too:
DocuSign Postman Collection
I'm trying out the Azure Mobile App API and getting an error on making Patch calls.
GET and POST and DELETE works fine.
Here is what my url looks like:
PATCH http://mymobileappapi.azurewebsites.net/tables/Skill/c89027fa-edce-4d36-b42a-ecb0920ebab6
body:
{
"name": "Leadership SDFF"
}
I have these as headers too (as I said other http verbs work.)
ZUMO-API-VERSION 2.0.0
Content-Type Application/Json
And I get 500 error back with this in the body:
{
"error": "An item to update was not provided"
}
The same id works when I do a GET using that id...
And when I make the same call using same body with PUT i get a 404 Not found without any content in the response body.
Any ideas?
It turns out our implementation requires the content-type header value to be lower case, i.e. application/json works, whereas Application/Json doesn't. I've updated this issue to be the placeholder for the fix. As a workaround in the meantime, make the value for the content-type header lower case.
https://github.com/Azure/azure-mobile-apps-node/blob/master/src/express/middleware/parseItem.js#L27
should use req.get instead of req.headers. Keep in mind that values can also include encoding, e.g. application/json; charset=utf-8
Here is link to the issue:
https://github.com/Azure/azure-mobile-apps-node/issues/368
Am reading this page by Boris Smus and tried to implement and everything is working good. The only problem is, the requests are failing after some time. Am using googleapis. As soon as I install my test extension and try to make some googleapi requests, they are passing. But aftersome time when I try the same they are failing.
In the background.js NET tab i see the following response.
{ "error": { "errors": [ { "domain": "global", "reason": "authError", "message": "Invalid Credentials", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Invalid Credentials" } }
If I just reload my extension everything is working fine again. Am thinking it is something to do with accesstoken but am not sure how/where to fix it.
Also what I observed from console tab of background.js page, google.isAccessTokenExpired() results in 'false' when everything is working. It returns TRUE when everything is failing. Where/How do I fix this problem.
Solved! Added the following code.
if(google.isAccessTokenExpired()) {
google.authorize(function() { myFunc(info); } );
}
Not sure why it dint't worked a while back. Now its working.
For me it worked fine for the userinfo API. But not for contacts API. The problem was solved by changing the Url for contacts from http to https
So the Url I used: https://www.googleapis.com/m8/feeds/contacts/default/full