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

Custom Fields: External ID support (AG-1605) #83

Merged
merged 5 commits into from
Apr 5, 2022

Conversation

moreira
Copy link
Contributor

@moreira moreira commented Mar 29, 2022

Problem

Using fieldID to reference a custom field it's hard because it's basically a computer generated UUID (e.g. FieldID-5227880d-0916-4048-a128-3b0930903c5f).
To make the life who is consuming Vendasta's external API easier this PR add supports to an alternative identifier, the External ID.

Solution

Basically the solution is all handled by our internal API's, api-gateway just have to accept the attribute ExternalID as an identifier for custom fields on the Upsert operations.

Upsert example:

{
    "data": {
        "id": "AG-VWD4VW8TGF:ORD-DHRVWDFKWW",
        "type": "orderCustomFields",
        "attributes": {
            "partnerFields": [
                {
                    "externalId": "number-test",
                    "integerValue": 10
                }
            ]
        }
    }
}

List example:

{
    "data": {
        "type": "productCustomFields",
        "id": "VUNI-MP-VFVG5LTKDPPTFV2MRC733PMVPM6DSPB5",
        "attributes": {
            "partnerFields": [
                {
                    "fieldId": "FieldID-8d7ac676-c84e-4afc-bd6a-99a60bde094f",
                    "externalId": "",
                    "title": "Currency test",
                    "description": "Enter currency",
                    "currencyValue": 1000,
                    "fieldType": "currency",
                    "currencyCode": "BRL"
                },
                {
                    "fieldId": "FieldID-dd9746a2-8a6f-465c-9888-a9f0ed9e3763",
                    "externalId": "days-to-use",
                    "title": "Days to use",
                    "description": "Number of days to use the app",
                    "fieldType": "integer"
                }
            ]
        }
    }
}

Notes

I had to remove fieldId's required flag, and I couldn't find a schema that would fieldId or externalId mandatory. There some discussion here, but it looks like it's dead end.

@vendasta/np-easy
@richard-rance
AG-1605

@moreira moreira marked this pull request as ready for review March 29, 2022 21:21
@richard-rance
Copy link
Member

We should probably also modify/add a few of the example update requests to show how you can use the new field.

@moreira moreira merged commit f391d63 into master Apr 5, 2022
@moreira moreira deleted the np-ag-1605-add-slugs-support branch April 5, 2022 20:58
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