Skip to content

Incorrect URI for retrieving delivery tokens — should be /stacks/delivery_tokens, not /delivery_tokens #70

@pcolas-castelis

Description

@pcolas-castelis

Description

While attempting to retrieve delivery tokens using the Contentstack .NET SDK, I encountered a 404 Not Found error. Upon investigation, it seems the SDK constructs the wrong endpoint for this operation.

Steps to Reproduce

  1. Initialize the Contentstack client using valid credentials and stack.
  2. Attempt to retrieve delivery tokens using:
var client = new(host: "https://eu-api.contentstack.com");
var credentials = new(userEmail, userPassword);
_ = client.Login(credentials);
var stack = client.Stack(options.ApiKey, null, options.Branch);
var response = stack.DeliveryToken().Query().Find();
  1. Observe the HTTP request being sent to:
    https://eu-api.contentstack.com/v3/delivery_tokens
  2. This request returns a 404 error.

Expected Behavior

According to the Contentstack Management API documentation, the correct endpoint for retrieving all delivery tokens is:
GET /v3/stacks/delivery_tokens

Root Cause

The likely issue is in the DeliveryToken class constructor:

internal DeliveryToken(Stack stack, string uid = null)
    : base(stack, "token", uid)
{
    resourcePath = uid == null ? "/delivery_tokens" : $"/delivery_tokens/{uid}";
}

This seems to incorrectly construct the path without the required /stacks prefix.

Suggested Fix

Update the resourcePath initialization to include /stacks:

resourcePath = uid == null ? "/stacks/delivery_tokens" : $"/stacks/delivery_tokens/{uid}";

Additional Notes

Let me know if there’s a workaround in the meantime or if I’m perhaps misusing the client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions