-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15671/
-----------------------------------------------------------

Review request for shindig.


Bugs: SHINDIG-1955
    https://issues.apache.org/jira/browse/SHINDIG-1955


Repository: shindig


Description
-------

As per 
http://opensocial.github.io/spec/2.5.1/Social-API-Server.xml#MediaItem-Service-Create:
 return the id of the newly created media item.

Note: this is a Java API change.


Diffs
-----

  
trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/MediaItemService.java
 1543384 
  
trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java
 1543384 

Diff: https://reviews.apache.org/r/15671/diff/


Testing
-------

Manual requests with curl to see the returns:

$ curl -vX POST -H Content-Type:application/json -d 
'{"albumId":"attachments","url":"http://a.fsdn.com/con/app/proj/eclipsejsonedit/screenshots/217754.jpg/182/137","title":"JSON
 Editor","type":"image","mimeType":"image/jpeg"}' 
http://localhost/api/rest/mediaItems/@me/@self/attachments?access_token=575d2a2e-40dc-4987-80eb-601429c0b6d1
* Adding handle: conn: 0x21c4ff0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x21c4ff0) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)
> POST 
> /api/rest/mediaItems/@me/@self/attachments?access_token=575d2a2e-40dc-4987-80eb-601429c0b6d1
>  HTTP/1.1
> User-Agent: curl/7.32.0
> Host: localhost
> Accept: */*
> Content-Type:application/json
> Content-Length: 172
> 
* upload completely sent off: 172 out of 172 bytes
< HTTP/1.1 200 OK
< Date: Mon, 18 Nov 2013 17:11:48 GMT
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Expires: Mon, 18 Nov 2013 17:11:48 GMT
< Pragma: no-cache
< Cache-Control: no-cache
< Content-Type: application/json;charset=UTF-8
< Content-Length: 48
< Set-Cookie: API_SESSIONID=218f66a4-387a-4cf5-8ae5-8f96a87a0516; Path=/api; 
HttpOnly
< Set-Cookie: rememberMe=deleteMe; Path=/api; Max-Age=0; Expires=Sun, 
17-Nov-2013 17:11:44 GMT
< 
* Connection #0 to host localhost left intact
{"entry":"8d330024-510b-4730-94fc-83831c374553"}


$ curl -vX GET -H Content-Type:application/json 
http://localhost/api/rest/mediaItems/@me/@self/attachments/8d330024-510b-4730-94fc-83831c374553?access_token=575d2a2e-40dc-4987-80eb-601429c0b6d1
* Adding handle: conn: 0x1bc5fd0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1bc5fd0) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET 
> /api/rest/mediaItems/@me/@self/attachments/8d330024-510b-4730-94fc-83831c374553?access_token=575d2a2e-40dc-4987-80eb-601429c0b6d1
>  HTTP/1.1
> User-Agent: curl/7.32.0
> Host: localhost
> Accept: */*
> Content-Type:application/json
> 
< HTTP/1.1 200 OK
< Date: Mon, 18 Nov 2013 17:12:26 GMT
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Expires: Mon, 18 Nov 2013 17:12:26 GMT
< Pragma: no-cache
< Cache-Control: no-cache
< Content-Type: application/json;charset=UTF-8
< Content-Length: 226
< Set-Cookie: API_SESSIONID=f4a71406-1caf-4a20-a746-4657d5a55047; Path=/api; 
HttpOnly
< Set-Cookie: rememberMe=deleteMe; Path=/api; Max-Age=0; Expires=Sun, 
17-Nov-2013 17:12:00 GMT
< 
* Connection #0 to host localhost left intact
{"entry":{"albumId":"attachments","type":"image","url":"http://a.fsdn.com/con/app/proj/eclipsejsonedit/screenshots/217754.jpg/182/137","id":"8d330024-510b-4730-94fc-83831c374553","title":"JSON
 Editor","mimeType":"image/jpeg"}}


NOTE: This is against our shindig-based application, so the returned ids are 
UUIDs instead of the timestamp. The timestamp might be problematic when many 
messages are created at the same point in time!


Thanks,

Andreas Kohn

Reply via email to