GraphQL support

Is there any way to consume / call graphQL API? Please help me on this.

Hi,
afaik GraphQL is based on HTTP (GET and POST).
So you could use Robotframework-Requests Library

You could also write your own Library in Python where you could define your way how to design keywords.

Thanks @René I am able to consume graphQL. Thanks a lot

Nice!

Could you please describe how?
If others have the same issue, you could help them solving it.

Here is my graphQL access code:

Access graphQL through robot framework
create session rootURL {BASE_URL} {body}= create dictionary query= { posts { post_content } }
&{header}= create dictionary Content-Type=application/json
{resp}= post request rootURL ... graphql ... data={body}
… headers={header} Should Be Equal As Strings {resp.status_code} 200
{jsonval} set variable {resp.json()}
log to console Console log response value ${jsonval}

Here is graphQL code for both query and mutation, example I provided is for canvas GrahQL API

  1. Get Data

Get Course Detail
${Canvas_API_Base_URL} = Set Variable ${base_url}
${Canvas_Authorization} = Set Variable ${auth_key}

${Headers}=       Create Dictionary    Authorization=Bearer ${Canvas_Authorization}    Content-Type=application/json
${body}=          Create dictionary   query= query courseInfo { course (id: "123") { name account { _id name } courseCode}}
Create Session    ucommons    ${Canvas_API_Base_URL}     disable_warnings=1
${result}=        Post Request    ucommons    api/graphql   headers=${headers}  data=${body}
Log To Console    ${result.json()}
  1. Update data
    Update assignment
    ${Canvas_API_Base_URL} = Set Variable ${base_url}
    ${Canvas_Authorization} = Set Variable ${auth_key}

    ${Headers}= Create Dictionary Authorization=Bearer ${Canvas_Authorization} Content-Type=application/json
    ${body}= Create dictionary query= mutation updateCouseName { __typename updateAssignment(input: {name: “QA Test”, id: “27”}) { assignment { name course { name } } } }
    Create Session ucommons ${Canvas_API_Base_URL} disable_warnings=1
    ${result}= Post Request ucommons api/graphql headers=${headers} data=${body}
    Log To Console ${result.json()}