Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.

Update docs/logic with POST /api/v3/posts endpoint #599

Open
weerd opened this issue Jan 29, 2018 · 4 comments
Open

Update docs/logic with POST /api/v3/posts endpoint #599

weerd opened this issue Jan 29, 2018 · 4 comments
Assignees

Comments

@weerd
Copy link
Contributor

weerd commented Jan 29, 2018

DOCUMENTATION

Affected Pages

Create a Post

Explanation

campaign_run_id: (int) optional. The drupal campaign run node id of the campaign that the user's post is associated with.

This item specifying the campaign_run_id as optional needs to be updated to indicate that it is required if the campaign_id is a Drupal ID.

One thing to note is that the campaign_id value can be either an integer or a string... and the Drupal ID can apparently be either (362 or "362"), but I doubt that's the case for the campaign_run_id. So I think it would make sense to also update the docs to specify that the campaign_id should be an int if a Drupal ID or a string if a Contentful ID. Thoughts?

@DFurnes
Copy link
Contributor

DFurnes commented Jan 29, 2018

I believe we're just checking if it's numeric or not (/[0-9]+/), since even if it's provided by the client as an integer it'd still be casted & stored as a string.

@weerd
Copy link
Contributor Author

weerd commented Jan 29, 2018

yeah, but then there's inconsistency cause in the scenario of the Drupal ID I could pass the campaign_id as a string but for the campaign_run_id it needs to be an integer. Maybe just update the campaign_run_id to accept both as well?

@DFurnes
Copy link
Contributor

DFurnes commented Jan 29, 2018

Same deal there I believe, Laravel's integer validator will just check if the provided value can be used as an integer (whether it's provided as a string or integer in the JSON body).

@weerd
Copy link
Contributor Author

weerd commented Jan 29, 2018

Okie dokes. Then just also an additional docs update to indicate as such for future ref that passing a string to the campaign_run_id is cool too :) 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants