Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk Synchronous Standards #69

Merged
merged 10 commits into from
Nov 20, 2023
Merged

Bulk Synchronous Standards #69

merged 10 commits into from
Nov 20, 2023

Conversation

travisgosselin
Copy link
Member

Proposal of new API Standards for bulk operations that attempt to provide some consistency with a RESTful approach. That being said there are many compromises here. This content covers concepts around Synchronous bulk operations to a single resource.

Bulk operations to multiple resources is out of scope, along with async bulk operations and async in general. That being said, schema for bulk operations should be reviewed and considered for consistency in future standards around async and schema.

@travisgosselin travisgosselin requested a review from a team as a code owner October 25, 2023 18:58
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Show resolved Hide resolved
standards/bulk.md Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
travisgosselin and others added 2 commits October 26, 2023 10:59
Co-authored-by: Evan Gilbert <[email protected]>
Signed-off-by: Travis Gosselin <[email protected]>
Co-authored-by: Evan Gilbert <[email protected]>
Signed-off-by: Travis Gosselin <[email protected]>
@travisgosselin travisgosselin self-assigned this Oct 26, 2023
@travisgosselin
Copy link
Member Author

travisgosselin commented Oct 31, 2023

  • This approach places the emphasis on supportin bulk operations for a single resource. Bulk operations may still be desirable at a larger network level across resources... and having a distinct resource for that would make sense as an API that supports providing batch support across many resources (proxy) - out of scope for this update:
POST network.api.spscommerce.com/v1/batch
{
    "operations": [
        {
            "method": "POST",
            "path": "/my-resource",
            "body": {
                "company": {
                    "id": 1234
                },
                "name": "Receiver Profile Name"
            },
            "result_placeholder": "${receiverPlaceholder}"
        }
}
  • Additionally, this specifies that it is for Synchronous handling of bulk updates. Async handling would require the use of a status monitor pattern potentially and may mean a new resource entirely for async bulk updates, such as an "import" endpoint: network.api.spscommerce.com/v1/resource-import. More details on async discussion will inform the approach to this. This draft is NOT ready for review just yet: Async Polling Standards #70

Copy link
Contributor

@brandonsahadeo brandonsahadeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, looks pretty good to me 👍🏼

@travisgosselin
Copy link
Member Author

travisgosselin commented Nov 2, 2023

Rough notes from our zoom meeting about this, thanks for everyone who participated:

- not idempotent
- patch atomicity - should we add an option in the request body to indicate if its all a single transaction or not?
	- we are ok with allowing partial updates given the lack of consistency in PATCH
	- lets move ahead with a proposed request parameter for transactions...? - have this but make it optional and provide a default
	- transactionality across requests (pages of patch)? - out of scope.
- response body is extendable?
	- NO need, and not ideal (for now)
- schema changes:
	{
		operationId:
		action: 
		entityId:
		entityRef:
		status:
		detail: {} extensible object?
			- define a better object here that can provide errors and details
	}

- ordinal? identifying response objects
	- ordinal should be "operationId"
	- operationId can be provided as a string on request (optional)
	- if not provided the response includes the index of the item from the original request

- multiple items in same PATCH for the same id
	- allow this, but indicate expectation for etag usage
	- suggestion on operationId usage in this regard (given the same id can appear twice)

- are enum actions and status extensible?
	- easy to make extensible later, not now

- Retreival? FETCH
	- different use case, to be excluded

- Etag Usage?
	-  no concerns here
	- response can return etags on each object
		- consistent with how we handle this today with individual objects.


I'll convert to Draft for now until updates are made in accordance with the above notes.

@travisgosselin travisgosselin marked this pull request as draft November 2, 2023 19:55
@travisgosselin travisgosselin added minor-change Small non-breaking modification to existing API Standard details. proposal New idea for discussion within the API Standards. labels Nov 14, 2023
@travisgosselin travisgosselin marked this pull request as ready for review November 14, 2023 04:10
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
standards/bulk.md Show resolved Hide resolved
standards/bulk.md Outdated Show resolved Hide resolved
@travisgosselin travisgosselin merged commit c1768a6 into main Nov 20, 2023
2 checks passed
@travisgosselin travisgosselin deleted the feature/sync-bulk branch November 20, 2023 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor-change Small non-breaking modification to existing API Standard details. proposal New idea for discussion within the API Standards.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants