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

[4.2.0] Error while adding API policy using APIM Product API with YAML payload #3046

Closed
dinuka10 opened this issue Aug 5, 2024 · 0 comments · Fixed by wso2/carbon-apimgt#12506

Comments

@dinuka10
Copy link

dinuka10 commented Aug 5, 2024

Description

Hi All,

I got below error , when I tried to add policy for API using Product API[1]
[2024-07-15 08:30:26,477] ERROR - ApisApiServiceImpl An error has occurred while adding an API specific operation policy org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]

[1] https://apim.docs.wso2.com/en/4.2.0/reference/product-apis/publisher-apis/publisher-v4/publisher-v4/#tag/API-Operation-Policies/operation/addAPISpecificOperationPolicy

Steps to Reproduce

Invoke the mentioned [1] REST API ( using below curl command ) to add a policy for API

curl -v -k -H "Authorization: Bearer 6908faa7-78c5-3259-a21c-0fbf7a5fd5a5" -H "Content-Type: multipart/form-data" -F policySpecFile=@setHeader.yaml -F synapsePolicyDefinitionFile=@setHeader.j2 "https://localhost:9443/api/am/publisher/v4/apis/6d47d20e-579f-4b36-9b63-a5ee67c5595f/operation-policies"

Find the sample policyFile & definitionFile here :
sampleFiles.zip

[1] https://apim.docs.wso2.com/en/4.2.0/reference/product-apis/publisher-apis/publisher-v4/publisher-v4/#tag/API-Operation-Policies/operation/addAPISpecificOperationPolicy

Affected Component

APIM

Version

wso2am-4.2.0

Environment Details (with versions)

No response

Relevant Log Output

No response

Related Issues

No response

Suggested Labels

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants