Skip to content

Use URI Templates for CRUD URLS #62

@steve-r-west

Description

@steve-r-west

Let's replace all the %1 and %2 in the resources.yaml with URI Templates, that have the resource type.

e.g.

get-collection:
    docs: "https://documentation.elasticpath.com/commerce-cloud/docs/api/promotions/get-promotion-codes.html"
    url: "/v2/promotions/%1/codes"
  get-entity:
    docs: "https://documentation.elasticpath.com/commerce-cloud/docs/api/promotions/get-promotion-codes.html"
    url: "/v2/promotions/%1/codes"
  delete-entity:
    docs: "https://documentation.elasticpath.com/commerce-cloud/docs/api/promotions/delete-promotion-codes.html"
    url: "/v2/promotions/%1/codes/%2"
  create-entity:
    docs: "https://documentation.elasticpath.com/commerce-cloud/docs/api/promotions/create-promotion-codes.html"
    url: "/v2/promotions/%1/codes"

to

get-collection:
    docs: "https://documentation.elasticpath.com/commerce-cloud/docs/api/promotions/get-promotion-codes.html"
    url: "/v2/promotions/{promotions}/codes"
  get-entity:
    docs: "https://documentation.elasticpath.com/commerce-cloud/docs/api/promotions/get-promotion-codes.html"
    url: "/v2/promotions/{promotions}/codes"
  delete-entity:
    docs: "https://documentation.elasticpath.com/commerce-cloud/docs/api/promotions/delete-promotion-codes.html"
    url: "/v2/promotions/{promotions}/codes/{promotions_codes}"
  create-entity:
    docs: "https://documentation.elasticpath.com/commerce-cloud/docs/api/promotions/create-promotion-codes.html"
    url: "/v2/promotions/{promotions}/codes"

Importantly the name of the parameter MUST be one of the keys in the resource.yaml.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions