Project

General

Profile

Messaging Management » History » Version 1

Eric Vieillevigne, 05/12/2015 01:31 PM

1 1 Eric Vieillevigne
{{>toc}}
2
3
4
5
h1. Messaging - msg
6
7
The messaging API is used to access the messaging section, retrieve the message list, add a new message, edit or delete a conversation... In order to access the messaging API, 
8
9
the client shall be already logged and authenticated with a valid session using the log method detailed above. 
10
11
h2. Messaging thread list- _msglistThread_
12
13
The method msglistThread enables a logged user to retrieve all the conversation threads lists of his account. To date the method returns the entire list without any limit. In 
14
15
next version of the method, the client will be able to limit the number of threads returns in the list by sending the number of threads present in the list.
16
17
The method returns the list of thread sorted by date, the most recent being the first of the date.
18
19
By sending an HTTP request http://yourserver/api?a01call=msglistThread
20
21
*Parameters*:
22
23
_No parameters_ for this method
24
25
*Response*:
26
<pre><code class="javascript">
27
{
28
  "a01":{
29
    "r":{
30
      "r":[
31
        {
32
          "nbMessage":"2",
33
          "lastMessage":{
34
            "mediaIds":[],
35
            "fromId":"130",
36
            "creationDate":"2011-07-07T08:40:01.00Z",
37
            "text":"Kid",
38
            "toIdsArray":[
39
              "131",
40
              "133"
41
            ],
42
            "read":"true",
43
            "threadToken":"1310004700795",
44
            "messageId":"800"
45
          }
46
        },{
47
          "nbMessage":"2",
48
          "lastMessage":{
49
            "mediaIds":[],
50
            "fromId":"130",
51
            "creationDate":"2011-07-07T07:50:34.00Z",
52
            "text":"",
53
            "toIdsArray":[
54
              "131",
55
              "130",
56
              "133"
57
            ],
58
            "read":"true",
59
            "threadToken":"1310025034708",
60
            "messageId":"793"
61
          }
62
        }
63
      ]
64
    },
65
    "cn":"msglistThread"
66
  }
67
}
68
        
69
</code></pre>
70
The Method response returns the list of thread conversations separated by a _','_ structured as followed:
71
72
<pre>
73
         {
74
          "nbMessage":"2",    _(number of messages in the thread)_
75
          "lastMessage":{     _(last message)_
76
            "mediaIds":[],     _(message url)_
77
            "fromId":"130",    _(sender profileid, to get name retreive in prfgetprofile)_
78
            "creationDate":"2011-07-07T07:50:34.00Z", _(message creation date in UTC format - offset shall be calculated with offset)_
79
            "text":"My message text here", _(Text message)_
80
            "toIdsArray":[ _(list of recipient profile id to get name retreive in prfgetprofile)_
81
              "131",
82
              "130",
83
              "133"
84
            ],
85
            "read":"true", _(boolean read=true, unread=false)_
86
            "threadToken":"1310025034708", _(thread tokenid, parameters for getthread)_
87
            "messageId":"793" _(id of the last message)_
88
          }
89
</pre>
90
91
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
92
93
*Error*:
94
95
|*Error Code*|*Type*|*Value*|*Description*|
96
|FiZClassId|un|501|User is not logged|
97
98
99
h2. Messaging threadview- _msggetthread_
100
101
The method _msggetthread_ allows the client to display the content of the conversation
102
103
The method returns the list of message sorted by date, the most recent being the first of the date.
104
105
By sending an HTTP request http://yourserver/api/msg/getthread?threadToken=1310004700795
106
107
*Parameters*:
108
109
|*Name*|*Type*|*Description*|
110
|threadToken|String|threadToken Information|
111
|Read|Boolean|optional value (default false) to set as read or not the thread|
112
113
*Response*:
114
<pre><code class="javascript">
115
parseResponse({
116
  "cn":"msggetthread",
117
  "feed":[
118
    {
119
      "mediaIds":[],
120
      "fromId":"130",
121
      "creationDate":"2011-07-07T08:40:01.00Z",
122
      "text":"Kid",
123
      "toIdsArray":[
124
        "131",
125
        "133"
126
      ],
127
      "read":"true",
128
      "threadToken":"1310004700795",
129
      "messageId":"800"
130
    },{
131
      "mediaIds":[],
132
      "fromId":"131",
133
      "creationDate":"2011-07-07T02:11:40.00Z",
134
      "text":"Keshui",
135
      "toIdsArray":[
136
        "131",
137
        "130",
138
        "133"
139
      ],
140
      "read":"false",
141
      "threadToken":"1310004700795",
142
      "messageId":"787"
143
    }
144
  ]
145
});
146
</code></pre>
147
148
The Method response returns the list of messages in a conversation separated by a _','_ structured as followed:
149
150
151
152
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
153
154
*Error*:
155
156
|*Error Code*|*Type*|*Value*|*Description*|
157
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
158
|FizApiInvalidParameterException|un|502|invalid token|
159
|FizApiModelDoesNotExistException|un|503|Object does not exists|
160
|FizApiModelRightException|un|504|Right exception to use this method|
161
162
h2. Messaging thread list- _msglistThread_
163
164
The method msglistThread enables a logged user to retrieve all the conversation threads lists of his account. To date the method returns the entire list without any limit. In 
165
166
next version of the method, the client will be able to limit the number of threads returns in the list by sending the number of threads present in the list.
167
168
The method returns the list of thread sorted by date, the most recent being the first of the date.
169
170
By sending an HTTP request http://yourserver/api?a01call=msglistThread
171
172
*Parameters*:
173
174
_No parameters_ for this method
175
176
*Response*:
177
<pre><code class="javascript">
178
{
179
  "a01":{
180
    "r":{
181
      "r":[
182
        {
183
          "nbMessage":"2",
184
          "lastMessage":{
185
            "mediaIds":[],
186
            "fromId":"130",
187
            "creationDate":"2011-07-07T08:40:01.00Z",
188
            "text":"Kid",
189
            "toIdsArray":[
190
              "131",
191
              "133"
192
            ],
193
            "read":"true",
194
            "threadToken":"1310004700795",
195
            "messageId":"800"
196
          }
197
        },{
198
          "nbMessage":"2",
199
          "lastMessage":{
200
            "mediaIds":[],
201
            "fromId":"130",
202
            "creationDate":"2011-07-07T07:50:34.00Z",
203
            "text":"",
204
            "toIdsArray":[
205
              "131",
206
              "130",
207
              "133"
208
            ],
209
            "read":"true",
210
            "threadToken":"1310025034708",
211
            "messageId":"793"
212
          }
213
        }
214
      ]
215
    },
216
    "cn":"msglistThread"
217
  }
218
}
219
        
220
</code></pre>
221
The Method response returns the list of thread conversations separated by a _','_ structured as followed:
222
223
<pre>
224
         {
225
          "nbMessage":"2",    _(number of messages in the thread)_
226
          "lastMessage":{     _(last message)_
227
            "mediaIds":[],     _(message url)_
228
            "fromId":"130",    _(sender profileid, to get name retreive in prfgetprofile)_
229
            "creationDate":"2011-07-07T07:50:34.00Z", _(message creation date in UTC format - offset shall be calculated with offset)_
230
            "text":"My message text here", _(Text message)_
231
            "toIdsArray":[ _(list of recipient profile id to get name retreive in prfgetprofile)_
232
              "131",
233
              "130",
234
              "133"
235
            ],
236
            "read":"true", _(boolean read=true, unread=false)_
237
            "threadToken":"1310025034708", _(thread tokenid, parameters for getthread)_
238
            "messageId":"793" _(id of the last message)_
239
          }
240
</pre>
241
242
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
243
244
*Error*:
245
246
|*Error Code*|*Type*|*Value*|*Description*|
247
|FiZClassId|un|501|User is not logged|
248
249
250
h2. Messaging count- _msgcount_
251
252
The method _msgcount_ allows the client to display the number of messages  after a certain date (by default the last login date)
253
254
The method returns the total number of messages received after a date, the number of new messages as well as the number of unread messages. 
255
256
By sending an HTTP request http://yourserver/api/msg/count?
257
258
*Parameters*:
259
260
|*Name*|*Type*|*Description*|
261
|date|date|date to calculate the message received after the date YYYY-MM-DDThh:mm:ss|
262
263
*Response*:
264
<pre><code class="javascript">
265
parseResponse({
266
  "cn":"msgcount",
267
  "feed":{
268
    "total":"38",/*total number of messages*/
269
    "newUnread":"0",/*total number of new messages*/
270
    "unread":"30",/*total number of unread messages*/
271
    "date":"2011-07-07T14:51:17.29Z"/*date of the last login*/
272
  }
273
});
274
</code></pre>
275
276
The Method response returns the list of messages in a conversation separated by a _','_ structured as followed:
277
278
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
279
280
*Error*:
281
|*Error Code*|*Type*|*Value*|*Description*|
282
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
283
|FizApiInvalidParameterException|un|502|invalid token|
284
|FizApiModelDoesNotExistException|un|503|Object does not exists|
285
|FizApiModelRightException|un|504|Right exception to use this method|
286
287
h2. Messaging count by user- _msgcountbyUser_
288
289
The method _msgcountbyUser_ calculates the number of messages of different type sorted by userId (by default the last login date)
290
291
The method returns the total number of messages received after a date, the number of new messages as well as the number of unread messages. 
292
293
By sending an HTTP request http://yourserver/api/msg/countByUser?
294
295
*Parameters*:
296
297
|*Name*|*Type*|*Description*|
298
|date|date|date from which starts the messages count - format 8601 |
299
300
*Response*:
301
<pre><code class="javascript">
302
parseResponse({
303
  "cn":"msgcountByUser",
304
  "feed":{
305
    "133":{/*ProfileId*/
306
      "total":"22",
307
      "newUnread":"0",
308
      "unread":"19",
309
      "date":"2011-07-07T15:28:32.22Z"
310
    },
311
    "131":{/*ProfileId*/
312
      "total":"16",
313
      "newUnread":"0",
314
      "unread":"11",
315
      "date":"2011-07-07T15:28:32.22Z"
316
    }
317
  }
318
});
319
</code></pre>
320
321
The Method response returns the list of messages in a conversation separated by a _','_ structured as followed:
322
323
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
324
325
*Error*:
326
|*Error Code*|*Type*|*Value*|*Description*|
327
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
328
|FizApiInvalidParameterException|un|502|invalid token|
329
|FizApiModelDoesNotExistException|un|503|Object does not exists|
330
|FizApiModelRightException|un|504|Right exception to use this method|
331
332
h2. Deleting a message- _msgdelete_
333
334
The method enables to delete a message of certain id.
335
336
By sending an HTTP request http://yourserver/api/msg/delete?messageId=123244
337
338
*Parameters*:
339
340
|*Name*|*Type*|*Description*|
341
|messageid|string|message id number|
342
343
*Response*:
344
<pre><code class="javascript">
345
TBD
346
</code></pre>
347
348
The Method response returns a boolean *True* (in case of success).
349
350
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
351
352
*Error*:
353
|*Error Code*|*Type*|*Value*|*Description*|
354
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
355
|FizApiInvalidParameterException|un|502|invalid token|
356
|FizApiModelDoesNotExistException|un|503|Object does not exists|
357
|FizApiModelRightException|un|504|Right exception to use this method|
358
359
h2. Deleting a message thread- _msgdeleteThread_
360
361
The method enables to delete a thread of messages of certain id.
362
363
By sending an HTTP request http://yourserver/api/msg/deleteThread?threadToken=threadtokenid
364
365
*Parameters*:
366
367
|*Name*|*Type*|*Description*|
368
|threadtokenid|string|tokenid number|
369
370
*Response*:
371
<pre><code class="javascript">
372
TBD
373
</code></pre>
374
375
The Method response returns a boolean *True* (in case of success).
376
377
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
378
379
*Error*:
380
|*Error Code*|*Type*|*Value*|*Description*|
381
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
382
|FizApiInvalidParameterException|un|502|invalid token|
383
|FizApiModelDoesNotExistException|un|503|Object does not exists|
384
|FizApiModelRightException|un|504|Right exception to use this method|
385
386
h2. Reading a message- _msgget_
387
388
The method enables to read a message of certain id.
389
390
By sending an HTTP request http://yourserver/api/msg/get?messageId=messageid
391
392
*Parameters*:
393
394
|*Name*|*Type*|*Description*|
395
|messageid|string|messageid number|
396
397
*Response*:
398
<pre><code class="javascript">
399
parseResponse({
400
  "cn":"msgget",
401
  "feed":{
402
    "mediaIds":[],
403
    "fromId":"130",
404
    "creationDate":"2011-07-08T17:26:59.00Z",
405
    "text":"text here",
406
    "toIdsArray":[
407
      "782"
408
    ],
409
    "read":"true",
410
    "threadToken":"1310146015861",
411
    "messageId":"130_926"
412
  }
413
});
414
</code></pre>
415
416
The Method response returns the message content .
417
418
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
419
420
*Error*:
421
|*Error Code*|*Type*|*Value*|*Description*|
422
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
423
|FizApiInvalidParameterException|un|502|invalid token|
424
|FizApiModelDoesNotExistException|un|503|Object does not exists|
425
|FizApiModelRightException|un|504|Right exception to use this method|
426
427
428
h2. Last Send Message- _msggetlastbysender_
429
430
The method returns the last message sent to the logged-in account by the given accountId.
431
432
By sending an HTTP request http://yourserver/api/msg/getlastbysender?accountId=accountid
433
434
*Parameters*:
435
436
|*Name*|*Type*|*Description*|
437
|accountid|string|accountid number|
438
439
*Response*:
440
<pre><code class="javascript">
441
parseResponse({
442
  "cn":"msggetlastbysender",
443
  "feed":{
444
    "mediaIds":[],
445
    "fromId":"130",
446
    "creationDate":"2011-07-08T17:26:59.00Z",
447
    "text":"text here",
448
    "toIdsArray":[
449
      "782"
450
    ],
451
    "read":"true",
452
    "threadToken":"1310146015861",
453
    "messageId":"130_926"
454
  }
455
});
456
</code></pre>
457
458
The Method response returns the last message (may be null) sent by the given accountId.
459
460
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
461
462
*Error*:
463
|*Error Code*|*Type*|*Value*|*Description*|
464
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
465
|FizApiInvalidParameterException|un|502|invalid token|
466
|FizApiModelDoesNotExistException|un|503|Object does not exists|
467
|FizApiModelRightException|un|504|Right exception to use this method|
468
469
h2. Change Read status of a specific thread- _msgmarkThread_
470
471
The method change a thread as read or as unread.
472
473
By sending an HTTP request http://yourserver/api/msg/markThread?threadToken=1310146015861&read=true
474
475
*Parameters*:
476
477
|*Name*|*Type*|*Description*|
478
|threadToken|String|threadToken Information|
479
|Read|Boolean|value to set as read or not the thread|
480
481
482
*Response*:
483
<pre><code class="javascript">
484
parseResponse({
485
  "cn":"msgmarkThread",
486
  "feed":"true"
487
});
488
</code></pre>
489
490
The Method response returns a Boolean (always true).
491
492
In case, the method encounter any error, the response is an exeception with specific parameters detailed below.
493
494
*Error*:
495
|*Error Code*|*Type*|*Value*|*Description*|
496
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
497
|FizApiInvalidParameterException|un|502|invalid token|
498
|FizApiModelDoesNotExistException|un|503|Object does not exists|
499
|FizApiModelRightException|un|504|Right exception to use this method|
500
501
h2. Sending a message- _msgsend_
502
503
The method send a new message to a recipient user as well as reply or forward an existing thread.
504
505
By sending an HTTP request http://yourserver/api/send?to=accountid&toName=dad&text=test%20%20message
506
507
*Parameters*:
508
509
|*Name*|*Type*|*Description*|
510
|to|String|Recipient Account Id may be multiple separated by "," or ";". may be empty|
511
|toName|String|Recipient Account Id may be multiple separated by "," or ";" may be empty|
512
|threadToken|String|associate a thread messageid in case of a forward or a reply|
513
|text|string|text of the message|
514
|file|binary or url|value to set as read or not the thread|
515
516
517
*Response*:
518
<pre><code class="javascript">
519
{
520
  "cn":"msgsend",
521
  "feed":{
522
    "mediaIds":[],
523
    "fromId":"130",
524
    "creationDate":"2011-07-27T14:57:28.52Z",
525
    "text":"test message",
526
    "toIdsArray":[
527
      "131"
528
    ],
529
    "read":"true",
530
    "threadToken":"1311778648525",
531
    "pictureURIs":[],
532
    "messageId":"130_4486"
533
  }
534
}
535
</code></pre>
536
537
The Method response returns a Imessage
538
The displayName of targets separated by "," or ";" (may be empty)
539
The accountIds of the target of the message (may be empty)
540
The threadtoken of the message we are replying, forwarding, null if simple new message. In case, the method encounter any error, the response is an exeception with specific 
541
542
parameters detailed below.
543
544
*Error*:
545
|*Error Code*|*Type*|*Value*|*Description*|
546
|FizMediaQuotaExceededException|ex|601|Media Quota exceedded|
547
|FizMessageInvalidRecipient|ex|100|Invalid recipient|
548
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
549
|FizApiInvalidParameterException|un|502|invalid token|
550
|FizApiModelDoesNotExistException|un|503|Object does not exists|
551
|FizApiModelRightException|un|504|Right exception to use this method|
552
553
554
555
h2. Sending a message to the family- _msgsendfamily_
556
557
The method send a message to whole the family.
558
559
By sending an HTTP request http://yourserver/api/msg/sendfamily?threadToken=1311778737613&text=helloworld
560
561
*Parameters*:
562
563
|*Name*|*Type*|*Description*|
564
|threadToken|String|associate a thread messageid in case of a forward or a reply|
565
|text|string|text of the message|
566
|file|binary or url|value to set as read or not the thread|
567
568
569
*Response*:
570
<pre><code class="javascript">
571
{
572
  "cn":"msgsendfamily",
573
  "feed":{
574
    "mediaIds":[],
575
    "fromId":"130",
576
    "creationDate":"2011-07-27T15:03:03.63Z",
577
    "text":"text here",
578
    "toIdsArray":[
579
      "133",
580
      "131",
581
      "1704",
582
      "1705",
583
      "1706"
584
    ],
585
    "read":"true",
586
    "threadToken":"1311778737613",
587
    "pictureURIs":[],
588
    "messageId":"130_4490"
589
  }
590
}
591
</code></pre>
592
593
The Method response returns a Imessage
594
595
*Error*:
596
|*Error Code*|*Type*|*Value*|*Description*|
597
|FizMediaQuotaExceededException|ex|601|Media Quota exceedded|
598
|FizAccountNotFoundInSessionException|un|501|Session is invalid|
599
|FizApiInvalidParameterException|un|502|invalid token|
600
|FizApiModelDoesNotExistException|un|503|Object does not exists|
601
|FizApiModelRightException|un|504|Right exception to use this method|