diff --git a/content/docs/api-reference.md b/content/docs/api-reference.md deleted file mode 100644 index bae3a74..0000000 --- a/content/docs/api-reference.md +++ /dev/null @@ -1,45 +0,0 @@ -# API Reference (WIP) - -**PseudoRESTAPI** exposes your API endpoints via the [gateway](https://gateway.pseudorestapi.com/). Currently, it only supports GET requests. - -## List Resources - -This will return all resources that are associated on that endpoint: - -```curl -curl -X GET https://gateway.pseudorestapi.com/api/{api-endpoint} -H "Accept: application/json" -u {api-key}:{secret-key} -``` - -You can also filter the list by the resource attribute, which you define when creating your **Resource Model**. - -For example, let's say our API endpoint is `employees` and it returns the following JSON data: - -```json -[ - { - "id": "32bdcb50-b9b8-4195-9b41-a915af76ee0d", - "fullname": "Ramona Corkery", - "position": "Developer" - }, - { - "id": "dd0adf02-5d18-4a7b-a9ab-43d3b55e0bc6", - "fullname": "Edward Okuneva", - "position": "Associate" - }, - { - "id": "12d89157-0de4-4ca0-ae3d-1ef017eb3cb4", - "fullname": "Pat Botsford", - "position": "Consultant" - } -] -``` - -We can filter the result by the `position` through the query params: `/api/employees?position=Consultant` - -## Retrieve Resource by ID - -This will return a specific resource by passing its ID: - -```curl -curl -X GET https://gateway.pseudorestapi.com/api/{api-endpoint}/{resource-id} -H "Accept: application/json" -u {api-key}:{secret-key} -``` diff --git a/content/docs/getting-started.md b/content/docs/getting-started.md index f2486f6..23b6ec1 100644 --- a/content/docs/getting-started.md +++ b/content/docs/getting-started.md @@ -1,87 +1,42 @@ # Getting started -**PseudoRESTAPI** uses GitHub OAuth to authenticate its users. First, you need to create a GitHub account before you can sign in the application. Once this is done, you can now proceed with the basic concepts: +**PseudoRESTAPI** uses GitHub OAuth to authenticate its users. First, you need to create a GitHub account before you can sign in the platform. Once this is done, you can now login. -- **Project** - refers to your mock server. Once you create a project, you will be given an API key and secret key to access your API endpoints. +## Creating your first app -- **APIs** - refers to the RESTful API endpoints. Each endpoint can be assigned with a resource, which will be returned in the endpoint's response. +Think of apps as mock servers, which can help you organize and group your fake endpoints. -- **Resources** - refers to the fake database. There are two sub modules here: +- To create an app, click the **New App** button on the dashboard and complete the form. Click, the **Proceed** button afterwards. - +Now that you've obtained your API key, let's create your models! -## Creating your first project +## Designing and populating your models -Once you log in the application, click the **New Project** button and complete the form: +- Click the models button on the left navigation bar. This will redirect you to the **Models** page where you will design the schema and generate the data for your fake database. -![Create Project](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0001-create-project.png) +- To create your first model, click the **New Model** button. Design your model based on your needs, then click **Proceed**. -Then, click the save button. You will notice that after saving, a notification will appear on the page displaying your project's secret key. Make sure to copy this secret key since this is the only time that you will see it! +- After saving, the model should appear as a tab menu in the page. Click on the new model and then click the insert (`+`) model data button. -![Display Secret Key](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0002-display-secret-key-v1.1.png) +- Adjust the slider based on the number of data that you want to generate, and complete the form. Then, click **Proceed**. -Afterwards, click your new project. This will redirect you to the **API** page. - -The next step is to create your resources and API endpoints, but before that, you must first acquire your API key. Click the settings button on the left navigation bar, then copy the API key below your project description: - -![Display API Key](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0003-display-api-key-v1.1.png) - -Unlike the secret key, you can always view your API key in the **Settings** page. - -Now that you've obtained your API key, let's create your database! - -## Designing and populating your database - -Click the resources button on the left navigation bar. This will redirect you to the **Resources** page where you will design the schema and generate the data for your fake database. - -To create your first model, click the **New Resource Model** button. You will be given many options to design your model but for now, you can follow the guide below: - -![Create Resource Model](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0004-create-resource-model.png) - -You will notice that the table on the right side will adjust based on the schema that we designed earlier. We can populate the table by clicking the **Manage Data < New** button. - -![Create Resource Data](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0005-create-resource-data-v1.1.png) - -Adjust the slider based on the number of data that you want to generate, then click save. - -The table should now display your mock data: - -![Display Resource Data](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0006-display-resource-data-v1.1.png) - -We can add more resources later, but for now let's proceed with creating the API endpoint. - -## Creating the API Endpoint - -The last step for your mock server is to create the API endpoint where you will expose the resources. - -Click the APIs button on the left navigation bar. This will redirect you to the **API** page. - -Afterwards, click the **New API** button and complete the form: - -![Create API Endpoint](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0007-create-api-endpoint.png) - -As you can see, you can select the resources that you created earlier in the previous section. Click save once you're satisfied with the details. - -We can now finally test your mock server. +- The table should now display your mock data. ## Testing the mock server You can test your API endpoint using cURL with the following format: -```curl -curl -X GET https://gateway.pseudorestapi.com/api/{api-endpoint} -H "Accept: application/json" -u {api-key}:{secret-key} +```js +curl -X GET \ + https://gateway.pseudorestapi.com/{model-name} \ + -H "Accept: application/json" \ + -u {api-key}:{secret-key} ``` -Note that the gateway application uses the basic scheme to authenticate the user. - -Here's an example in postman: - -![Postman Request](https://cgspqoueygtgcuofenqv.supabase.co/storage/v1/object/public/docs/0008-postman-request-v1.1.png) - -That's it! You've now created your own mock server. +That's it! You've now created your fake server. diff --git a/content/docs/http-methods.md b/content/docs/http-methods.md new file mode 100644 index 0000000..bf0d2c8 --- /dev/null +++ b/content/docs/http-methods.md @@ -0,0 +1,52 @@ +# HTTP Methods + +**PseudoRESTAPI** exposes your models via [PseudoGatewayAPI](https://gateway.pseudorestapi.com/). You can use any tool to send requests to your mock server. Just make sure to encode your credentials in **base64** string. + +## GET + +```js +curl -X GET \ + https://gateway.pseudorestapi.com/api/{model-name} \ + -H "Accept: application/json" \ + -u {api-key}:{secret-key} +``` + +## GET by ID + +```js +curl -X GET \ + https://gateway.pseudorestapi.com/api/{model-name}/{id} \ + -H "Accept: application/json" \ + -u {api-key}:{secret-key} +``` + +## POST + +```js +curl -X POST \ + https://gateway.pseudorestapi.com/{model-name} \ + -H "Accept: application/json" \ + -H "Content-Type: application/json" \ + -u {api-key}:{secret-key} \ + -d '{"key1": "value1", "key2": "value2"}' +``` + +## PUT + +```js +curl -X PUT \ + https://gateway.pseudorestapi.com/{model-name}/{id} \ + -H "Accept: application/json" \ + -H "Content-Type: application/json" \ + -u {api-key}:{secret-key} \ + -d '{"key1": "value1", "key2": "value2"}' +``` + +## DELETE + +```js +curl -X DELETE \ + https://gateway.pseudorestapi.com/{model-name}/{id} \ + -H "Accept: application/json" \ + -u {api-key}:{secret-key} +``` diff --git a/content/docs/index.md b/content/docs/index.md index 5ead859..4122ebf 100644 --- a/content/docs/index.md +++ b/content/docs/index.md @@ -1,10 +1,15 @@ -# PseudoRESTAPI - Official Documentation +# What is PseudoRESTAPI? -> ⚠️ I'm currently reworking this project. -> Expect the docs to be outdated! +**PseudoRESTAPI** is a hassle-free way to create fake RESTful endpoints, no coding required. Think of it this way: you're a developer itching to test a cool new feature in your app, but diving into server stuff isn't your jam right now. No problem! -This is the official guide to **PseudoRESTAPI.** +With PseudoRESTAPI, you can avoid the headache of faking fetch requests or crafting fake endpoints. It's like magic for testing. Just log in, give your model a name, cook up some fake data, and boom – you've got a fake server. -You can start by reading the [Getting Started](/docs/getting-started) to understand the basic concepts and usages so you can immediately begin using the application. +## Why PseudoRESTAPI? -Other documents detail advance usages, and other information that you might want to check later to better understand the tool. +- **Easy Peasy:** No need to be a coding wizard. Our platform is designed for everyone, from coding ninjas to beginners. + +- **Speedy Testing:** Test your ideas in a snap. PseudoRESTAPI lets you focus on your app without sweating the server stuff. + +- **Model Magic:** Just log in, name your model, and whip up some fake data. PseudoRESTAPI makes fake servers a breeze. + +Ready to dive in? You can begin by reading the [Getting Started](/docs/getting-started). diff --git a/layouts/docs.vue b/layouts/docs.vue index 036d335..8461d5f 100644 --- a/layouts/docs.vue +++ b/layouts/docs.vue @@ -1,10 +1,10 @@ @@ -19,7 +19,21 @@ -
+