Texts

httpkom.texts.texts_create()

Create a text.

Request

POST /<server_id>/texts/ HTTP/1.0

{
  "body": "räksmörgås",
  "subject": "jaha",
  "recipient_list": [ { "type": "to", "recpt": { "conf_no": 14506 } } ],
  "content_type": "text/x-kom-basic",
  "comment_to_list": [ { "type": "footnote", "text_no": 19675793 } ]
}

Responses

Text was created:

HTTP/1.0 201 Created
Location: http://localhost:5001/<server_id>/texts/19724960

{
  "text_no": 19724960,
}

Example text:

curl -v -X POST -H "Content-Type: application/json" \
     -d '{ "body": "räksmörgås", \
           "subject": "jaha",
           "recipipent_list": [ { recpt: { "conf_no": 14506 }, "type": "to" } ], \
           "content_type": "text/x-kom-basic", \
           "comment_to_list": [ { "type": "footnote", "text_no": 19675793 } ] }' \
     "http://localhost:5001/lyskom/texts/"

Example image:

curl -v -X POST -H "Content-Type: application/json" \
     -d '{ "body": <base64>, \
           "subject": "jaha",
           "recipipent_list": [ { recpt: { "conf_no": 14506 }, "type": "to" } ], \
           "content_type": "image/jpeg", \
           "content_encoding": "base64", \
           "comment_to_list": [ { "type": "footnote", "text_no": 19675793 } ] }' \
     "http://localhost:5001/lyskom/texts/"
httpkom.texts.texts_delete_mark(text_no)

Unmark a text.

Request

DELETE /<server_id>/texts/<text_no>/mark HTTP/1.1

Response

Success:

HTTP/1.1 204 OK

Example

curl -v -X DELETE "http://localhost:5001/lyskom/texts/4711/mark"
httpkom.texts.texts_delete_read_marking(text_no)

Mark a text as unread in all recipient conferences.

Request

DELETE /<server_id>/texts/<int:text_no>/read-marking HTTP/1.0

Responses

Text was marked as read:

HTTP/1.0 204 NO CONTENT

Example

curl -v DELETE "http://localhost:5001/lyskom/texts/19680717/read-marking"
httpkom.texts.texts_get(text_no)

Get a text.

Note: The body will only be included in the response if the content type is text.

Request

GET /<server_id>/texts/19680717 HTTP/1.0

Responses

Text exists:

HTTP/1.0 200 OK

{
  "body": "räksmörgås",
  "recipient_list": [
    {
      "conf_name": "Oskars Testperson",
      "type": "to",
      "loc_no": 29,
      "conf_no": 14506
    }
  ], 
  "author": {
    "pers_no": 14506,
    "pers_name": "Oskars Testperson"
  }, 
  "creation_time": "2013-11-30T15:58:06Z",
  "comment_in_list": [],
  "content_type": "text/x-kom-basic",
  "text_no": 19680717,
  "comment_to_list": [],
  "subject": "jaha"
}

Text does not exist:

HTTP/1.0 404 NOT FOUND

{ TODO: error stuff }

Example

curl -v -X GET -H "Content-Type: application/json" \
     "http://localhost:5001/lyskom/texts/19680717"
httpkom.texts.texts_get_body(text_no)

Get the body of text, with the content type of the body set in the HTTP header. Useful for creating img-tags in HTML and specifying this URL as source.

If the content type is text, the text will be recoded to UTF-8. For other types, the content type will be left untouched.

Request

GET /<server_id>/texts/19680717/body HTTP/1.0

Responses

Text exists:

HTTP/1.0 200 OK
Content-Type: text/x-kom-basic; charset=utf-8

räksmörgås

Text does not exist:

HTTP/1.0 404 NOT FOUND

{ TODO: error stuff }

Example

curl -v -X GET -H "Content-Type: application/json" \
     "http://localhost:5001/lyskom/texts/19680717/body"
httpkom.texts.texts_get_marks()

Get the list of marked texts.

Request

GET /<server_id>/texts/marks/ HTTP/1.1

Response

HTTP/1.1 200 OK

{
  "marks": [
    { "text_no": 4711, "type": 100 },
    { "text_no": 4999999, "type": 101 },
  ]
}

Example

curl -v -X GET -H "Content-Type: application/json" \
     "http://localhost:5001/lyskom/texts/marks/"
httpkom.texts.texts_put_mark(text_no)

Mark a text.

Request

PUT /<server_id>/texts/<text_no>/mark HTTP/1.1

{
  "type": 100
}

Response

Success:

HTTP/1.1 201 Created

Example

curl -v -X PUT -H "Content-Type: application/json" \
     -d { "type": 100 } \
     "http://localhost:5001/lyskom/texts/4711/mark"
httpkom.texts.texts_put_read_marking(text_no)

Mark a text as read in all recipient conferences.

Request

PUT /<server_id>/texts/<int:text_no>/read-marking HTTP/1.0

Responses

Text was marked as read:

HTTP/1.0 201 Created

Example

curl -v -X PUT "http://localhost:5001/lyskom/texts/19680717/read-marking"