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

Toolkit doesn't forward documents POST body #17

Open
tcaruth opened this issue Feb 8, 2022 · 3 comments
Open

Toolkit doesn't forward documents POST body #17

tcaruth opened this issue Feb 8, 2022 · 3 comments

Comments

@tcaruth
Copy link

tcaruth commented Feb 8, 2022

Attempted making the following call within a component. Locally through the toolkit, it doesn't work. If I upload the component to an OCM instance, my folders are created.

const reqFetch = await fetch(`/documents/api/1.2/folders/${strParentFolderId}`, {
	body: JSON.stringify({
		name: strFolderName,
		description: strFolderDescription
	}),
	headers: {
		'Authorization': `session`,
		'Content-Type': 'application/json'
	},
	method: 'post'
})
const objResponse = await reqFetch.json()

I believe the toolkit isn't passing the body of my request on, since the error I get looks like this:

{
  "errorCode": "-97",
  "errorKey": "!csFldUnableToCreateFolder!csItemMustSpecifyName",
  "errorMessage": "Unable to create folder. You must specify an item name.",
  "title": "Unable to create folder. You must specify an item name.",
  "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}

See relevant code on/around this section of the documentsRouter

if (requestUrl.indexOf('/documents/api/') >= 0) {

@hzeng99 @BrianJCheyne
Can this be addressed, or was it intentionally left out?

@hzeng99
Copy link
Contributor

hzeng99 commented Feb 8, 2022

Currently the local server only supports rendering the OOTB documents related components.

@tcaruth
Copy link
Author

tcaruth commented Feb 9, 2022

Meaning you can't create folders with the API while running through the toolkit?

tcaruth added a commit to tcaruth/content-and-experience-toolkit that referenced this issue Feb 9, 2022
@tcaruth
Copy link
Author

tcaruth commented Feb 9, 2022

I know pull requests aren't typically merged or used in this repository. #18 is simply for other toolkit users to have a quick reference if they also need to be able to test this API locally.

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 a pull request may close this issue.

2 participants