rwblair / pyrolific

Unofficial autogenerated openapi python client for api.prolific.co
0 stars 1 forks source link

API specification for completion codes is wrong #3

Open chkgk opened 1 year ago

chkgk commented 1 year ago

Hi,

Prolific's API documentation is wrong w.r.t. how to specify completion codes. Even their minimal example from the docs does not work correctly. Reference: https://docs.prolific.co/docs/api-docs/public/#tag/Studies/paths/~1api~1v1~1studies~1/post

Rather than sending:

{
...
  "completion_option": "code",
  "completion_codes": [
    {
      "code": "ABC123",
      "code_type": "COMPLETED",
      "actions": [
        {
          "action": "MANUALLY_REVIEW"
        }
      ]
    }
  ],
...
}

one actually needs to send:

{
...
  "completion_option": "code",
  "completion_code": "ABC123",
  "completion_code_action": "MANUALLY_REVIEW",
  "completion_option": "url",
...
}

The OpenAPI Specification file contains the same error as in the docs. The functions in this wrapper need to be adapted accordingly. Unfortunately, I have not figured out how to set custom completion codes.

rwblair commented 6 months ago

I completely missed your issues, thank you for opening them. At the very least I'll try and incorporate these workarounds into the README. Why my automatic approval codes weren't working had me stumped.

How did you figure out the correct field names?

chkgk commented 6 months ago

Hi!

It's been a while. I am not even sure this bug still exists. It was acknowledged by Prolific's support last July. I think I checked the requests their web frontend sends and tried the same fields with the official API. It also involved a lot of trial and error if I remember.

Note what Prolific support told me at the time: "Our team have let us know this is a minor ongoing bug with the API. Please rest assured, it is working correctly, but it's not displaying correctly in the UI. The team have recommended you check that the return from the POST request matches what you put in."

Unfortunately, using the documented fields left studies in a state in which they could not be edited on the web frontend. Using the fields I found left the studies in a working state. Probably still not a great idea to rely on undocumented api fields.

Best Christian