-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
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
- Initialize the Contentstack client using valid credentials and stack.
- 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();
- Observe the HTTP request being sent to:
https://eu-api.contentstack.com/v3/delivery_tokens - 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels