chemokita13 / beReal-api

A not official BeReal rest API in wich you can get all posts info, comment, upload a post...
https://berealapi.fly.dev
79 stars 5 forks source link

Issue with post/upload/data #27

Open ghost opened 10 months ago

ghost commented 10 months ago

Getting the error shown below while trying to execute the post/upload/data (step 3) request. Do you know why I am getting this error? Step 1 and 2 work as expected. Have i put some wrong information in "postData"?

My request body: { "postData": { "resize": false, "late": true, "visibility": "friends", "retakes": 0, "caption": "Hello", "taken_at": "2024-01-14T16:14:51.123Z", "location": "[48.864716, 2.349014]" }, "tokenData": "here is my postDataToken" }

This is what the server responses: { "status": 500, "message": "Internal server error", "data": { "response": { "status": 400, "message": "Post not created", "data": { "done": false, "msg": { "message": "Request failed with status code 400", "name": "AxiosError", "stack": "AxiosError: Request failed with status code 400\n at settle (/app/node_modules/axios/dist/node/axios.cjs:1970:12)\n at IncomingMessage.handleStreamEnd (/app/node_modules/axios/dist/node/axios.cjs:3069:11)\n at IncomingMessage.emit (node:events:531:35)\n at endReadableNT (node:internal/streams/readable:1696:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)", "config": { "transitional": { "silentJSONParsing": true, "forcedJSONParsing": true, "clarifyTimeoutError": false }, "adapter": [ "xhr", "http" ], "transformRequest": [ null ], "transformResponse": [ null ], "timeout": 0, "xsrfCookieName": "XSRF-TOKEN", "xsrfHeaderName": "X-XSRF-TOKEN", "maxContentLength": -1, "maxBodyLength": -1, "env": {}, "headers": { "Accept": "application/json, text/plain, /", "Content-Type": "application/json", "Authorization": "Bearer censored", "user-agent": "BeReal/1.0.1 (AlexisBarreyat.BeReal; build:9513; iOS 16.0.2) 1.0.0/BRApriKit", "x-ios-bundle-identifier": "AlexisBarreyat.BeReal", "Content-Length": "442", "Accept-Encoding": "gzip, compress, deflate, br" }, "method": "post", "url": "https://mobile.bereal.com/api/content/posts", "data": "{\"isLate\":true,\"retakeCounter\":0,\"takenAt\":\"2024-01-14T16:14:51.123[Z]\",\"caption\":\"Hello\",\"visibility\":[\"friends\"],\"backCamera\":{\"bucket\":\"storage.bere.al\",\"height\":2000,\"width\":1500,\"path\":\"Photos/censored/post/censored.webp\"},\"frontCamera\":{\"bucket\":\"storage.bere.al\",\"height\":2000,\"width\":1500,\"path\":\"Photos/censored/post/censored.webp\"},\"location\":{\"latitude\":\"[\",\"longitude\":\"4\"}}" }, "code": "ERR_BAD_REQUEST", "status": 400 } } }, "status": 400, "message": "Post not created", "name": "HttpException" } } I replaced private stuff with "censored".

chemokita13 commented 9 months ago

Hey! The post upload endpoints actually are giving some issues. Maybe the error is in the caption, idk, can you try it without caption to see what returns?

TomCasavant commented 9 months ago

I get the same error without the caption

TomCasavant commented 9 months ago

If it helps, when I don't pass in the values as json it successfully posts the bereal except it doesn't have either image (caption/location/visibility all work)

image

e.g.: This posts without any images:

    url = base_url + "/post/upload/data"
    post_data = {"resize":"...", "late":"...", ... }
    headers = {"token":self.jwt_token, "accept": "application/json"}
    data = {"postData": post_data, "tokenData": token_data}
    response = requests.post(url, headers=headers,  data=data)

And this gives the Request failed with status code 400 error

    url = base_url + "/post/upload/data"
    post_data = {"resize":"...", "late":"...", ... }
    headers = {"token":self.jwt_token, "accept": "application/json"}
    data = {"postData": post_data, "tokenData": token_data}
    response = requests.post(url, headers=headers, json=data)
chemokita13 commented 9 months ago

I will work on it!

3eif commented 7 months ago

Any update on this?

chemokita13 commented 7 months ago

Any update on this?

I am working on it! I think it wont be more than 4 or 5 days