Can't find any way to call lastReadMessageIndex Method - twilio-conversations

I'm developing an endpoint in my nodeJs backend project and I can't find any way to call the lasReadMessageIndex Method.
I read the horizon documentation and there says:
The same lastReadMessageIndex is also available from the REST API and can also be changed from your backend service.
But it doesn't mention where is this API which route should I call.
Anyone could help me please?

Within the Conversations REST API, the last_read_message_index and the last_read_timestamp would be available on the Conversation Participant Resource (and the multi-service version as well).
You would be able to fetch this value or update these values for each participant, directly from the REST API.
Conversation Participant Resource: https://www.twilio.com/docs/conversations/api/conversation-participant-resource
Multi-service Conversation Participant Resource: https://www.twilio.com/docs/conversations/api/service-participant-resource
Read-Horizon documentation reference: https://www.twilio.com/docs/conversations/read-horizon#:~:text=a%20Message.%0A%0AThe-,same,-lastReadMessageIndex%20is%20also

Related

How to update DNSSEC using GoDaddy's API?

Reading through GoDaddy's domains endpoint documentation ( https://developer.godaddy.com/doc/endpoint/domains ) am trying to use GoDaddy's API to update DNSSEC records (DS records to be more precise). Very few examples (found none actually) are out there showing how to actually do that.
The above documentation does seem to mention a "model" called DomainDnssec (same URL as above) which does refer to values and their types that need to be either POST'ed or GET'ed using one of the API URLs but it's not clear to me which one. What is "model" in that context anyway (literally just a description of data types that have to be posted or received using particular API endpoints? this is not clear to me either and documentation is silent about that)?
As much as I do not have an issue with using API in general (all set up and working, together with finding out infamous customerId which most folks confuse with shopperId), I'm having a hard time finding which API call allows interacting with DNSSEC on GoDaddy's API.
I did not try much yet as none of the actions (API calls) within the API domain namespace documentation seems related particularly to DNSSEC.
===an update
It seems that in the Action model (https://developer.godaddy.com/doc/endpoint/domains#/), there is a reference to API calls that do not seem to be documented:
DNSSEC_CREATE - Request to create DNSSEC record for the domain via PATCH /v2/customers/{customerId}/domains/{domain}/dnssecRecords
DNSSEC_DELETE - Request to delete DNSSEC record for the domain via DELETE /v2/customers/{customerId}/domains/{domain}/dnssecRecords
Not sure why this call is not explicitly documented among other v2 API calls. An overlook? Still not sure how to build API calls allowing to update DNSSEC records.

TODOIST API: How to get list of users to assign a specific user to task?

It seems that API allows to assign users to a task (called an Item in the API) using the body field responsible_uid at the add an item endpoint. However I cannot find a way to list user uids or any other way to get user details anywhere in API documentation.
Official python library todoist-python doesn't provide any way to do this either. So for now it seems I can only create tasks without assigning them to anybody, which is a bummer.
Any advise grately appreciated!
Links:
Todoist Sync API
Todoist
REST API
You should first share a project and then you can get all collaborators in the Sync request.

Passing params to POST API

I am new to designing REST APIs. I have trying to create following APIs for online game play
GET domain/api/games // return all games
POST domain/api/games // create a new game on behalf of current user
Now my issue is that when I try to create game using POST, I want userId to be sent to the API. I am not sure how to do this. Also note that I have another get API to get details of individual game, something like
GET domain/api/games/{gameId}
so I cannot pass userId to POST like domain/api/games/{useID} as it will conflict will above API.
So how do I pass usedId to POST. Also I don't want to use query params. Any suggestions to design this would be great.
When you are making a POST to a service, the parameters you communicate are known as BODY params, they don't go on the query string.
Different technologies have different APIs for interacting with POST params, but the underlying theory is the same, and is described by the W3C HTTP standard
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
The specifics of how to use POST params vary depending on the language and technology you're using. For example, if you are using jquery, there are a couple different ways to do it, with with the $.post('url', data, callback) method or with the $.ajax(...) option.
http://api.jquery.com/jquery.post/
http://api.jquery.com/jquery.ajax/
When reading POST params on the server, you'll generally access them using some some sort of request object, that will store your parameters in memory for you to access. This is highly dependent of the language and framework you're using, but here are links to some common ones:
NodeJS/express: http://expressjs.com/4x/api.html#request
PHP: http://php.net/manual/en/reserved.variables.post.php
ASP.Net: http://msdn.microsoft.com/en-us/library/system.web.httprequest.params(v=vs.110).aspx
Java/Spring: https://spring.io/guides/gs/handling-form-submission/
It should be either part of the context (you can pass it through header) or part of the game object. I prefer the context option, the httpheader can contain some auth bearer token so that you can figure out the user on the backend through the token.

What does "consume an API" mean?

Here is an excerpt from an assignment I am currently doing:
Build a dummy app that:
Contains a REST API that operates over a single resource.
Contains a Backbone client that consumes that API and can list, show, create, update, and remove that resource.
My understanding was that the term "consume" implies total coverage of the API's exposed ressources. However, the assignment says "consumes that API and can [CRUD] that resource".
Is that sentence redundant or is my understanding of the term wrong?
(Bonus question: why searching Google for this question returns countless language-specific tutorials for "consuming an API" but none explain what the term actually means?).
To consume an API means to basically use any part of it from your application.
Consuming an API here means creating a client which can send requests to the API that you build.
It appears that you need to create and API which can handle Create, retrieve, update and delete (CRUD) of a resource. For instance if your REST api is to create a blog, your API should handle CRUD functions for the object/resource blogpost.
POST - Create a blog post
GET - Retrieve a blog post
PUT - Update a blog post
DELETE - Delete a blog post.
It is about the direction of the app's interaction with API - it either provides an API, or consumes it, so there are providers and consumers of API, and this is just a less general and ambiguous term than 'using'.
Simply consuming an API means using it in your application.
For, e.g., GET request to https://someapi/Users will give you all the users.
You need to request this URL https://someapi/Users to get all the users and then you can use it into your application.
I always think about Albert Einstein's quote of "If you can’t explain it to a six year old, you don’t understand it yourself." when someone asks a question that you might take for granted due to technical experience you have on a subject.
I think the following medium.com article does an excellent job explaining it: How do you explain API to a 5-year-old?
simply means : using the API.
You can do it with HTTP method (GET, POST, PUT, DELETE..) using something like Postman (Tool) or maybe you have a client app/library that calls these methods implicitly.

Worklight api console request for Push

I need to get a list of users for a specific Push adapter/event source, and, I'm trying to use the API console requests, which says the format is:
http://{hostname}:{port}/{context-root}/console/api/{api-context}/{action}/{parameters}
and I'm using:
http://192.168.1.106:10080/Module_07_04_nativeAPIForiOSPush/console/api/Push/get/PushAdapter/PushEventSource
to search the demo project, which has one subscriber. However, I get 404 return from a browser request.
The first column of the docs is the "api-context", but, it lists "Push" and "Event Sources", which, obviously seems invalid.
What is the correct format to find users subscribed to a push for a specific adapter/event source?
WL server does not provide API for listing subscribed users. By design you should maintain your own DB of subscribed users, this is why you have onSubscribe onUnsubscribe callbacks in event source. As an alternative - you can look into WL's DB tables to find this info.