Skip to content

External claim creation api#1

Open
LuizFNJ wants to merge 4 commits intomainfrom
external-claim-creation-api
Open

External claim creation api#1
LuizFNJ wants to merge 4 commits intomainfrom
external-claim-creation-api

Conversation

@LuizFNJ
Copy link
Copy Markdown
Collaborator

@LuizFNJ LuizFNJ commented Jun 15, 2025

Context

During this process, I had some doubts, especially about whether this was exactly what was expected, but I believe this serves as a base and we can improve on it if needed.

In this PR, I basically created an external API inside this repository that makes requests to the Aletheia claim creation API.

Local Testing Setup

I tested this locally by running the Aletheia platform on port 4000 and this repository (the external API) on port 3000. This setup allowed me to successfully send requests between the two systems:

  • One directly to the Aletheia API
  • One externally, through the API created in this repository

Example Requests

Directly to Aletheia API:

curl --location --request POST 'http://localhost:4000/<API_CLAIM_CREATE>' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
  "title": "Test made directly to the Aletheia API",
  "content": "Content coming directly from the Aletheia claim creation API",
  "date": "2025-06-15T00:00:00.000Z",
  "contentModel": "Speech",
  "sources": ["https://directapi.com"],
  "recaptcha": "12345",
  "personalities": ["684b2b554283922af4b6728f"],
  "nameSpace": "main"
}'

Through the External API:

curl --location --request POST 'http://localhost:3000/<API_CLAIM_CREATE>' --header 'Content-Type: application/json' --data '{
  "title": "Test made through the external API",
  "content": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
  "date": "2025-06-15T00:00:00.000Z",
  "contentModel": "Speech",
  "sources": ["https://www.lipsum.com/"],
  "recaptcha": "123451234",
  "personalities": ["685698585836d839690544f7"],
  "nameSpace": "main"
}'

Next Steps

  1. How will it be done to get the IDs of the personalities to be used to create a claim?
  2. Since I’ve already made the API send requests to Aletheia’s API, the only difference for handling reports (denúncias) would be the request body.
    Given that, could I reuse the same controller and simply adjust the logic based on the content of the body, or would I actually need to create a separate controller, service, and everything else?

@LuizFNJ LuizFNJ requested a review from thesocialdev June 15, 2025 21:19
@thesocialdev
Copy link
Copy Markdown
Contributor

@LuizFNJ this is still missing the token creation step.

@LuizFNJ LuizFNJ force-pushed the external-claim-creation-api branch from e140e7d to a56e559 Compare August 2, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants