Labs/F1/Modularity/WebMod-API: Difference between revisions

Jump to navigation Jump to search
thrash out send()
(tweaks to getAutocompleteEntries)
(thrash out send())
Line 69: Line 69:
   one call per character typed, that call need not result in network activity)
   one call per character typed, that call need not result in network activity)


=== send(user_info, data) ===
=== link.send.send(credentials_blob, data) ===


Send an item as described by "data" - ie, perform the actual share.
Send an item as described by "data" - ie, perform the actual share.
credentials_blob is the blob returned by the authentication process, or null if the WebMod does not provide the blob during auth.
data is a json object describing the message to be send.  The fields are TBD but will be based closely on the F1 implementation.  No user info will be included in this data.
==== success result ====
The result will be a json object with the following fields:
; status: The status of the send.  Currently the only supported value is ''sent'', but services may also return, eg, ''pending'' to indicate it has been queued and will be sent when (eg) the network becomes available.
; link: A link to the message that was just shared - eg, if the message was sent via twitter, the link would point at the specific tweet.
==== error result ====
If an error occurs, it will be reported via the normal jschannel error callback (ie, with ''error'' and ''message'' parameters, where the content of ''message'' will depend on the value of ''error''.  The following error values are supported:
;authentication: Indicates the message failed due to an authentication problem (eg, the cookie expired).  Authentication will be re-performed and the user will be given the opportunity of retrying the error.  ''message'' will be null.
;http_error: Indicates a HTTP error occurred sending the item.  ''message'' will be the http error code.  This would be an appropriate error if a back-end server returned a 500 error (eg, twitter was down), but is '''not''' appropriate for a 401 error - the service should translate a 401 to an ''authentication'' error if re-authentication is necessary.
; captcha: Indicates that even though the user is correctly logged in, the service requested a captcha be solved before the message can be sent.  ''message'' will be an object with fields ''imageurl'', ''audiourl'' and ''message''.  F1 will display the message and the image, and provide a way to play the audio, and after the user enters the answer, will re-try the send request with the optional captcha fields included.
Any other value will cause ''message'' to be displayed in a generic error dialog, after which the user may either retry or abandon the share.
Confirmed users
99

edits

Navigation menu