How to organize requests for users in REST API? [closed] - api

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I have self-written API where urls are organized like:
GET /api/products
PUT /api/products/1
So there are controllers (ProductController.php, for example) and these controllers have four methods: get, post, put and delete.
Is this a right way to organize rest api?
If so, how to organize registration/authorization? Because both actions use POST method

Yes. I would recommend looking at how big companies are doing this kind of work. See how Github is structuring their API
Relies on what kind of authentication/authorization you want to use. Most companies choose Oauth with JWT, you could also use session-based authentication. For me, it's not clear what you exactly want to do. Maybe you can elaborate on that.

Related

which is the better convention for REST API URL [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 months ago.
Improve this question
I am new to REST API, and I am designing my own REST API for my web project.
Which of the followings is the better convention?
I want to access to the article that user ID 3 wrote.
/user/3/article
/article?user_id=3
Thanks.
Which of the followings is the better convention?
They are both fine.
/article?user_id=3 may prove more convenient if you are expecting to use HTML forms as a way of finding resources.
/user/3/article may prove more convenient if you expecting to use dot segments to describe other resource identifiers in the hierarchy.
What if I want to access to the fourth article that User ID3 wrote? /user/3/article/4 is appropriate? I think this hierarchy is unnecessarily deep.
Deep hierarchies are fine. Not using deep hierarchies are also fine.
In some designs, we'll use resource identifiers for items that are not part of the same hierarchy as the collection itself
context="/user/3/article" rel="item" href="/articles/4"
context="/user/3/article" rel="item" href="/articles/9"
context="/user/3/article" rel="item" href="/articles/16"
Think "web page with links"; if you can follow a link, you don't need a formula to compute the URI yourself.

Can we automate APIs usiing testCafe? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Caw we automate APIs using testCafe? I have a requirement to automate both Web & APIs together, I mean after doing some actions on the UI, I need to test relevant APIs.
I'm not sure if I understand well your needs but if you want to check the result of an api request I guess you'll need the RequestLogger : a hook you can add to your test on some specific api's urls and then in your test you will be able to check what the request contains.
Documentation here: https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/logging-http-requests.html

JIRA: Create API documents [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
Is it possible to create API documents on JIRA? If yes then how? The currently employed approach involves creating / updating a Microsoft Word document and replacing it on Confluence. This approach though fulfills the requirement but do not seems a better way for API documentation management.
Thanks
Uploading Microsoft Word documents is probably the worst way.
Although I find Confluence (and JIRA) to be terrible, I write API docs using a table and it works well:
Once you have a template, copy and paste to grow the docs.

Using Yowsup or WhatsAPI to send messages to Whatsapp groups [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to send a message to a group from my application/ server. I want to use Yowsup or WhatsAPI. Which is better? How should I go about it?
This is what I've found for Yowsup: http://openwhatsapp.org/develop/ and https://github.com/tgalal/yowsup
This is what I've found for WhatsAPI: https://github.com/venomous0x/WhatsAPI
Also, I'm building a web application, not a native one. Is this a problem?
It will depend on the language of programming you are Good at What API uses PHP. use the update library here https://github.com/mgp25/Chat-API/tree/master
The best way to start is by downloading the examples and reading the wiki before getting started the examples are fully functional.
Yowsup is python based library and I have not had a look at it :( on any-day I would go for What API, and YES you can integrate it with your php web scripts.
Hope this helped

Monitoring all the information of users using mvc 4 web api [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a REST service based on mvc 4 and web api. I need to monitor all the users who are using my service (eg: user name , organization that user belongs to, how many hours he is accessing service and so). can you please provide best architecture for this. what is the best way to doing this?
You can use a custom HttpMessageHandler for doing authentication and track all the information you need about the user in a database. You will need some background processing of that data and doing some statistics about the usage of the API. About the message handler, a good start is the one provided in Thinktecture.IdentityModel library (You can customize it),
http://leastprivilege.com/2013/04/22/asp-net-web-api-security-the-thinktecture-identitymodel-authenticationhandler/