I've deployed the "pizza" dialog to my Bluemix account. I'm using Postman to verify the REST interactions prior to my coding implementation. I'm able to retrieve the dialog id using the dialog REST GET. Taking the returned dialog id I establish a new conversation (leave client_id and conversation_id) empty:
https://gateway.watsonplatform.net/dialog/api/v1/dialogs/ee93cf6e-8718-4524-b10c-4f20fee90883/conversation
I use the returned conversation id to send another conversation request but I first set in the header the conversation_id, and the input value to "A large Pizza"
https://gateway.watsonplatform.net/dialog/api/v1/dialogs/ee93cf6e-8718-4524-b10c-4f20fee90883/conversation
Rather than getting the next turn in the dialog asking for toppings I get a new conversation id and new client id, and input asking me again for what size pizza I'd like to order.
Should I be able to test the dialog interaction using Postman, and why are my subsequent dialog requests all being treated as new conversation requests?
Appreciate any advice.
You said you are setting the conversation ID in the header so I am going to assume you may be passing that ID parameter incorrectly. According to the Watson Dialog API Explorer it states that if you do not pass in a conversation_id it will start a new conversation. Since you pass the converation_id incorrectly it thinks you did not provide one and will start a new conversation with you.
Since you are using Postman, try setting the conversation_id in the Body of the POST and not in the header.
Related
I am trying to integrate Glympse into my application using their REST api. But I can not get user-shared location in a card from api /v2/tickets/{ticketID} with the ticketID I got from card member info. It always return invalid ticket ID.
I noticed there is a HTTPS push API. Is it true that user-shared location only can be got by HTTPS push API? Is it possible to get it by normal rest API?
It sounds like you know how to get to the invite code from a card, but I'll still include some of those steps in case it helps others.
This is how to get the user's list of cards.
Doc: https://developer.glympse.com/docs/core/api/reference/cards/get
Endpoint: https://api.glympse.com/v2/cards
This is how to get the details about a single card. You can also optionally pass "members=true" and/or "invites=true" to this call to get added details.
Doc: https://developer.glympse.com/docs/core/api/reference/cards/id/get
Endpoint: https://api.glympse.com/v2/cards/{cardId}?members=true
This is how to get a member of a card. The last ticket that was shared to the card will be found in the member's invite_code value.
Doc: https://developer.glympse.com/docs/core/api/reference/cards/id/members/mid/get
Endpoint: https://api.glympse.com/v2/cards/{cardId}/members/{memberId}
This is how to get the location data associated with a ticket invite code.
Endpoint: https://api.glympse.com/v2/invites/{inviteCode}?next={x}
The 'next' value is used to get just the location updates since the last call. When first querying an invite code, 'next' should be set to 0. For future calls on the same invite code, you should pass the 'next' value found in the previous call's result.
The location data is returned as a JSON array of delta values. More info on delta encoding here...
Doc: https://developer.glympse.com/docs/core/api/reference/tickets/id/append_location/post
Is it possible to receive the previous message that the user have send to the chatbot (without using quick replies or postback buttons). Example:
User: "Can you call a friend?"
Bot: "Who should I call?"
User: "Tim"
In the API I now have just the information "Tim", without knowing if I should call him or text him or make him a sandwich or whatever. So I basically I want to add some Postbackdata or metadata additionally to the text "Can you call a friend" (intent: 'CALL'), so the message "Tim" will come with that data.
Is there a way without storing the data into a database? AWS Lambda with ClaudiaJs.
I found the metadata field in the FB API which turns out to be the wrong field for that since it is only for communicating between several apps?!
What you are looking for a called a "slot-based bot", or slot-filling, basically meaning that you have a "slot", or blank that needs to be filled in before your bot can perform an action. In your example you have two slots: action and person
Actions could be: call, text, message
Person: name of a person, friend, etc.
I don't think any of the message frameworks (Slack, Facebook, etc) will provide you with the information you need. You will need to build this logic out yourself.
You can look at using wit.ai stories to achieve this.
Look to this similar Stack Overflow question and answer.
You can reverse order of conversation, and at beginning user writes some text or send you something else. After receiving, you should send to user buttonsTemplate, where postbacks will be like "CallTo&Tim" where instead of Tim you can put every text you need to pass to next executor(and you also can store previous user message here). Than just make substring of postback, check it`s type and do whatever you want.
when using github users api to return users data through
https://api.github.com/users?page=6&per_page=2
return the same data every one although change page parameter value and per_page
why this and how to fix to change different data
i try to edit header request and add this header
Name Link
Value <https://api.github.com/users?page=1&per_page=2>; rel="next",<https://api.github.com/users?page=50&per_page=2>; rel="last"
But Still not working
After my search
now Github use API V3 and if you want return users with paging you can use this
https://api.github.com/users?since=1&per_page=100
Instead of using "page" and "per_page", that endpoint uses "since" and "per_page".
The since parameter says from which user ID the API should start listing users. For example:
https://api.github.com/users?since=1&per_page=100
will start listing users from the user with ID 1, and
https://api.github.com/users?since=10001&per_page=100
will start listing users from the user with ID 10001.
I am designing an application that needs to dynamically load a form via an AJAX request. There should be three "modes": "create user", "update user", and "view user" (readonly).
However in all three cases, I am fetching a resource - thus these should all be GET requests (I'm not talking about the URIs I use to actually submit the form). They're all (virtually) the same form, so I consider them to be the same resource.
It seems to me that I could do something like:
GET /forms/users // Get a blank form for creating a new user
GET /forms/users/u/1?mode="view" // Get a form that shows info for user 1
GET /forms/users/u/1?mode="update" // Get a form that allows updating info for user 1
Or something like:
GET /forms/users // Get a blank form for creating a new user
GET /forms/users?id=1&mode="view" // Get a form that shows info for user 1
GET /forms/users?id=1&mode="update" // Get a form that allows updating info for user 1
Would either of these be "correct" according to REST? Or should I do something else?
The URL should be describing the resource, something like:
GET /forms/info/user/new // form to create a new user
GET /forms/info/user/1 // form to view user 1 info
You can pass a query string parameter to make the form updatable. Ex:
GET /forms/info/user/1?updatable=true
But that sounds like a browser, not a REST concern. REST is for communicating with API, and updating the user info would just require a PUT verb instead of the GET.
So just add some javascript code to make the form editable by a user.
Use the GET for "view user" operation and to get the user properties, use the PUT for the "create user" operation and for "update user" operation use the PATCH. This is the way I used to do.
It's an unusual practice to get a form from the REST API, having the client side application to show entire forms fetching from the API.
In your case you're right I guess, the only alternative I can see is
GET /forms/user/add // Get a blank form for creating a new user
GET /forms/user/view/1 // Get a form that shows info for user 1
GET /forms/user/update/1 // Get a form that allows updating info for user 1
I am developing mobile application and now I'm preparing server API.
There will be search bar and user will be able to search other people by using mutliselects, inputs (just like web form).
And now the question is - what type of HTTP request is the most appropriate to send parametrized request to the server (using cURL) and get friends list as response?
I am thinking of using GET, but user will be able to set multiple values for one argument:
state - user can select more than one state
So I thought that using POST with request body in JSON format will be the best.
{"states":["state1", "state2", "state3", ...]}
But reffering to https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-p2-semantics-16#section-7.5:
POST is designed to allow a uniform method to cover
the following functions:
o Annotation of existing resources;
o Posting a message to a bulletin board, newsgroup, mailing list, or
similar group of articles;
Can anyone advise what type of query should I use?
You can send multi-dimensional data in URLs like:
http://g.com/p.php?arr[]=1&arr[]=2
See:
AngularJS - How to send multidimensional $http.get() data
For another example.