Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Update iOS app to leverage new REST endpoints on Kitura-based server. #22

Closed
rolivieri opened this issue Apr 14, 2016 · 9 comments
Closed
Milestone

Comments

@rolivieri
Copy link
Collaborator

rolivieri commented Apr 14, 2016

We plan to use the Mobile Client Access SDK for iOS to perform REST invocations from the iOS app to the server.

@rolivieri rolivieri modified the milestones: 0.2, 0.1 Apr 14, 2016
@rolivieri rolivieri modified the milestones: 0.2, 0.1 Apr 19, 2016
@rolivieri
Copy link
Collaborator Author

rolivieri commented Apr 25, 2016

These endpoints are under construction:

  • /users - GET - Returns all users.
  • /users/:userId - GET - Returns a specific user, given the userId value.
  • /users - POST - Creates a new user - The payload should be a JSON document; as of now, the only required field in the JSON document is name: {"_id": "123453", "name": "John Doe", "language": "en-US", "unitsOfMeasurement": "e"}, where _id is the facebook userId.
  • /images - GET - Returns all images metadata.
  • /users/:userId/images/:fileName/:displayName/:width/:height/:latitude/:longitude/:location - POST - Stores a new image under the specify user. The payload (body) of the request should only contain the binary data for the image. Use the REST endpoint URL to specify the values for the userId, fileName, displayName, latitude, and longitude values.
  • /users/:userId/images - GET - Returns images metadata for the specified user.

@xanderbuck
Copy link
Contributor

xanderbuck commented Apr 28, 2016

Successfully hit the following endpoints:

  1. /users - GET
  2. /users/:userId - GET
  3. /users - POST
  4. /images - GET

more to come

@xanderbuck
Copy link
Contributor

@rolivieri When I create a new user (/users - POST) would it be possible to also get the full user record back? ie. also include the name?

right now it gives me

"{\n "id" : "129622",\n "ok" : true,\n "rev" : "1-6e5cfbbfee665ea3dc8563d5b9f4dc52"\n}")

@xanderbuck
Copy link
Contributor

Also when I get user by id, the id key is "_id" where as when I do create user, the id key is "id", could we make those consistent.... hopefully getting the full user record back when I create a new user will fix that

@rolivieri
Copy link
Collaborator Author

@xanderbuck Yes, I will certainly make those changes. The reason for the difference in _id vs id is that in one case you are getting back the raw response from Cloudant after adding a record. I will massage that response so that you are completely abstracted from it. Will also add the name. Keep you posted!

@rolivieri
Copy link
Collaborator Author

@xanderbuck You can now pull the latest backend code. It has the changes discussed above.

@rolivieri
Copy link
Collaborator Author

@xanderbuck - The following two endpoints have been changed:

  • /users - POST
  • /users/:userId/images/:fileName/:displayName/:latitude/:longitude/:city - POST

See description above for details on the updates for these two endpoints.

@xanderbuck
Copy link
Contributor

Possible bug when you have images with the same file name

@xanderbuck
Copy link
Contributor

Why do we call it displayName...? Shouldn't it be called caption?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants